ChemPare Documentation - v0.0.0
    Preparing search index...

    Function findCAS

    • Searches for a valid CAS number within a string. Returns the first valid CAS number found, or undefined if none are found.

      Parameters

      • data: string

        The string to search for a CAS number

      Returns void | `${string}-${string}-${string}`

      The first valid CAS number found, or undefined

      findCAS('Example of a valid cas: 1234-56-6..') // Returns '1234-56-6'
      findCAS('and 50-00-0 is another valid cas #') // Returns '50-00-0'
      findCAS('Example of an invalid cas: 1232-56-6..') // Returns undefined
      findCAS('and 50-00-1 is another valid cas #') // Returns undefined