Ensign
Ensign
140 views

Need help with changing variable regex

I'm trying to parse a message that is either empty or has a value. The message is \"phones\": \"\" and it changes when there's a value between the quotes for instance \"phones\": \"xxxx\"


\\"phones\\": \\"([^\\]+)\\" --> this doesn't parse after the second quotation.

\\"phones\\": \\"?([^\\]+)\\" --> this parses but includes the second quotation in the value column. 

I need it to stay empty if there's no value and if there's a value I need to pick the value without the quotation marks.
Would appreciate any assistance.

Labels (2)
0 Likes
1 Reply
Vice Admiral
Vice Admiral

you can probably use "conditional mappings" to solve this.

Look for "conditional mappings" in "FlexConnector Developer's Guide".

With conditional mappings you can do something like

'if token = "\" map empty value to field'

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.