Sign in to follow this  
Followers 0
gcue

trying to parse data using regexp

3 posts in this topic

I am trying to pull 812465E5:0506330 and UNVL_SLO_S09 from this string:

<NDL>

<REPLICA 812465E5:0506330>

<HINT>CN=UNVL_SLO_S09/O=SHUZ</HINT>

</NDL>

Here's what I have so far:

$server = StringRegExp($string, '<HINT>CN=I[\w]+/O=SHUZ</HINT>',2)
 
$replica = StringRegExp($string, '<HINT>CN=I[\w]+/O=SHUZ</HINT>',2)

it just returns the whole line.. i think i know why - because what im doing is just redefining the line, how do I use Regexp to give me the characters in between and NOT the ones i specify?

thanks in advance!

Share this post


Link to post
Share on other sites



These might be backwards...

$string =  "<NDL>" & _
   "<REPLICA 812465E5:0506330>" & _
   "<HINT>CN=UNVL_SLO_S09/O=SHUZ</HINT>" & _
   "</NDL>"
$server = StringRegExp($string, "<REPLICA ([\w\d]*:[\w\d]*)>", 3)
$replica = StringRegExp($string, "<HINT>CN=([\w\d_]*)/O=SHUZ</HINT>", 3)
MsgBox(0, "", "$server[0] = " & $server[0] & @CRLF & "$replica[0] = " & $replica[0])

Share this post


Link to post
Share on other sites

perfect!!!!!

many thanks!!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0