Jump to content

Regexp Help


Recommended Posts

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

 

Link to comment
Share on other sites

$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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...