Regex Pattern

0
Hi Team,  I want to get substring of a string ending with a space. For example  My Original String is ‘123456 My Order Number’ My Output Should be ‘123456  ‘ like this Tried this pattern : (12.*?\s) using RegexReplaceAll java action. It didn’t Worked out well. Any suggestions would be helpful Thanks in Advance.
asked
2 answers
3

Hi Stella,

Try below expressions:

^\S*   or   ^([\S]+) 

answered
1

Hi Stella, do you have to use regex? If not have a look at the community commons on the market place. It contains a java action to split strings according to a specific character, in your case splitting by the spaces. 
You would only have to add a trailing space again.

Br

Alex

answered