Hello,

I want to use RegEx to save the found String. An Example is: "testest-I-123456-testest" or "testest-O-1234-testest". The String "I-123456" or "O-1234" should be returned. 

My RegEx pattern looks like this:

"/([A-Z]{1})\-([1-9]{3,})/"

I've also tried: 

"([A-Z]{1})(-)([1-9]{3,})"


But the function doesn't seem to find anything. What am I doing wrong?


Thank you in advance.

aheristchi wrote:

Hello,

I want to use RegEx to save the found String. An Example is: "testest-I-123456-testest" or "testest-O-1234-testest". The String "I-123456" or "O-1234" should be returned. 

My RegEx pattern looks like this:

"/([A-Z]{1})\-([1-9]{3,})/"

I've also tried: 

"([A-Z]{1})(-)([1-9]{3,})"


But the function doesn't seem to find anything. What am I doing wrong?


Thank you in advance.

Test your regex with http://regexstorm.net/tester.

And For regular expressions, you can try using the Text and HTML Processing component:

https://www.outsystems.com/forge/component/2007/text-and-html-processing/


Thanks


Hi,

The format always start by "testest-" and ends with "-testest"? If yes you can remove that test with string functions.

Regards,

Marcelo

Hi aheristchi,


Using your second patern i am getting your expected output. You just need to use the .PatternResult property to get the value from your regex search.




Hope this helps !

Solution

Romero wrote:

Hi aheristchi,


Using your second patern i am getting your expected output. You just need to use the .PatternResult property to get the value from your regex search.




Hope this helps !

Thank you for your reply Romero. At least I know I was on the right way :)

My mistake was the "[1-9]", because I also have zeros in the string. So now it's "[0-9]". Works perfectly fine!

Regards,

aheristchi


Solution