Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Regexp function to extract numbers

Hello, 

Does Appian have any inbuilt function to extract numbers only from a text string?

Eg: If the string field is "ABC 123" then how to get the value of 123

 

Thanks, 

Rohit 

  Discussion posts and replies are publicly visible

Parents
  • Regexp will not work if you are not looking for a specific pattern. If a specific pattern then yes, use Regexp.
    There are many way to find integer value, as suggested by others. You can also try comparing with index of each element of your string/array. Choice should yours but based on your code performance. Thanks
  • 0
    A Score Level 1
    in reply to Amit Mishra

    A lot of these examples appear to show a fundamental misunderstanding of regex. If you'd like to do this using regex, you can use:

    fn!regexallmatches(
      "[0-9]+",
      "ABC 123"
    )

    Note that you'll have to choose between fn!regexallmatches and fn!regexfirstmatch depending on your data; the former returns a list of matches and the latter returns only the first match.

    If you'd like to see and/or test regexes, this tool is an excellent option and (as per the link) allows you to share and test regexes.

Reply
  • 0
    A Score Level 1
    in reply to Amit Mishra

    A lot of these examples appear to show a fundamental misunderstanding of regex. If you'd like to do this using regex, you can use:

    fn!regexallmatches(
      "[0-9]+",
      "ABC 123"
    )

    Note that you'll have to choose between fn!regexallmatches and fn!regexfirstmatch depending on your data; the former returns a list of matches and the latter returns only the first match.

    If you'd like to see and/or test regexes, this tool is an excellent option and (as per the link) allows you to share and test regexes.

Children
No Data