Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Parsing multiple values using Regular Expression

Churchie
Tera Guru

Greetings Everyone-

 

I am having some trouble trying to parse out a couple variables after running a Parse Command Output in a Discovery Pattern. The output looks like the attached.

I can parse the two fields I want in individual steps but I need to capture them into one table with the two values and I cant for the life of me get the Regular Expression to grab them both.

The first value I want is the line with only the numbers "00001". I can get this with ^([0-9]+)$
The second value I want is the numbers that follow the line that starts with "License u". I can get this with ^License u[a-z]+: (\S+).
What I am having trouble with is putting both of these two together so I cant get an expression to account for the text in between that first value and the second value which i don't want but need to account for. I am starting to think its an issue with ServiceNow's Regular Expression parser. RegEx101 can parse it but uses Match and Group to display it. I don't think ServiceNow has the ability to grab Match/Group. Any help would be appreciated.

 

0 REPLIES 0