Regular expression

  • 19 November 2014
  • 0 replies
  • 12 views






Symptoms




I have found a regular expression to extract a number from a file name. got the file name with a smart object and assigned it to a data field.

the regular expression works on http://www.regexr.com/ but when used with the Regular Expression inline functions in K2 Studio, the workflow says " parsingandampquote - unrecognized escape sequence.

the regular expression is this : ^.*_(.*)..*$



Diagnoses




The original regex works at http://www.regexr.com/, but throws the same error when testing with a .Net regex tester

.Net Regex Tester:
http://regexhero.net/tester/

The "_" was change to "_" as as per blog post:
http://stackoverflow.com/questions/16019812/why-is-the-regex-match-throwing-an-exception



Resolution

Removing the backlash in "_" such that the regex is "^.*_(.*)..*$" resolved the error. Additionally, string manipulation via the use of other inline functions were used to extract the wanted data.








0 replies

Be the first to reply!

Reply