Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regular expresion to get XML value?

Marcal_Oliveras
Active Contributor
0 Likes
778

Hello,

I'm totally lost with regular expresions... But I'm sure that it's possible to get the "Out" value if I have this XML into an string with regular expresion...

How can I do this?

I need to get the value 8456 into a variable.

<?xml version="1.0" encoding="UTF-8"?>

<Values version="2.0">

<value name="Out">8456</value>

<value name="In">8899</value>

</Values>

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
542

Will this help ?


DATA: var TYPE string.

var = '<value name="Out">8456</value>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN var with space.
WRITE: var.
skip 1.
var = '<value name="In">8899</value>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN var with space.
WRITE: var.
skip 1.

2 REPLIES 2
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
543

Will this help ?


DATA: var TYPE string.

var = '<value name="Out">8456</value>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN var with space.
WRITE: var.
skip 1.
var = '<value name="In">8899</value>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN var with space.
WRITE: var.
skip 1.

Read only

Former Member
0 Likes
542

I'm kind of lazy. I would just run it through FM SOTR_TAGS_REMOVE_FROM_STRING

Concatenating everything together as input gives 8456 8899 as output