Hi
i Need to extract the below information from this tag
<zone h='50000' id='8' name='Sheet 2' show-title='true' w='84000' x='0' y='50000' />
I have tried the below regex expression
^[ ]*<zone h='(.*?)' id='(.*?)' name='(.*?)' show-title='(.*?)' w='(.*?)' x='(.*?)' y='(.*?)' />$
Whats wrong with the above regex expression, It returns null.
Expecting it to return vaues
Thanks
Karthik
Uploaded the sample workflow.
Solved! Go to Solution.
At a guess there is a trailing extra space in the input. I would suggest you make the regex a little more loose:
<zone\s*h='([^']*)'\s*id='([^']*)'\s*name='([^']*)'\s*show-title='([^']*)'\s*w='([^']*)'\s*x='([^']*)'\s*y='([^']*)'\s*/>
This will not be as sensitive to white space.
I prefer [^']* over the .*? as we know looking for next '
Hi
It did not help , still returns null
Thanks
Karthik
Hi @vishwakar,
An alternative to extracting the data within the apostrphies does not use regex at all. Instead you can use a Text to Columns tool and split to rows using an apostrophy as the delimiter which results in the data being "flipped" vertically to rows anywhere there was an apostrophy:
Once the data is in that format, you can use a Multi Row forumula tool with the following expression: IF Contains([Field1], "=") THEN [Row+1:Field1] ELSE Null() ENDIF. This looks for a cell of data that contains an equals sign, and when it finds one of those cells, it will populate a new field with the value just below it:
You can then filter the new field based on NULL values to get a final results of:
This option is a bit more dynamic as you won't have to account for all of the "name='value'" bits in your data. Attached is an example workflow of the above process using your sample data
Thanks for your solution , I need Regex as part of the work flow which is easier rather than converting to text to columns and appending makes its complex.
Thanks
Karthik
What method are you using with the regex tool?
Because your original expression perfectly works to me with the parse method.