Jump to content
Sign in to follow this  
wisem2540

Regexp Help

Recommended Posts

wisem2540

I struggle with this often.  I am trying to return CAMPUS (not case sensitive) all the way up to the floor number.  Either a SPACE or the end of the line should signify the end of what I am trying to capture.  Any help would be appreciated

 

CAMPUS:This-would be a Site Name,BUILDING:MOB 1,FLOOR:01 IP:10.11.12.13

 

Share this post


Link to post
Share on other sites
iamtheky
$sString = "CAMPUS:This-would be a Site Name,BUILDING:MOB 1,FLOOR:01 IP:10.11.12.13"

msgbox(0, '' , stringregexp($sString , "(.*FLOOR:.*)\sIP" , 3)[0])

may have to change the stuff outside the capture to just a whitespace (\s), if IP is not always next.

but then if the strings are all formatted that exact way you could just take everything up to IP

msgbox(0, '' , stringregexp($sString , "(.*)\sIP" , 3)[0])

 

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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  

×