Jump to content
Sign in to follow this  
gcue

stringregexp match

Recommended Posts

$string = "Last Keyword XMP                : test"
ConsoleWrite(StringRegExp($string , "\s+:\s+(.*\z)" , 3)[0] & @CRLF)

 


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

Share this post


Link to post
Share on other sites

very welcome,  as well without regexp (provided the colon is always there)

consolewrite(stringstripws(stringmid($string , stringinstr($string , ":" , 0 , -1) + 1) , 1) & @CRLF)

 


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

Share this post


Link to post
Share on other sites

i tried to use it (tried switching with a V to accept anythign that isnt a vertical whitespace character) with this but it didnt work even if i took out the comma

$string = "GPS Position                    : 75 deg 7 41.99 N, 118 deg 3 37.21 W"
ConsoleWrite(StringRegExp($string, '\V+$', 1)[0] & @CRLF)

 

Share this post


Link to post
Share on other sites

Do you agree when I say that  "75 deg 7 41.99 N, 118 deg 3 37.21 W"  is a little different string than  "test" ?
:)

$string = "GPS Position                    : 75 deg 7 41.99 N, 118 deg 3 37.21 W"
ConsoleWrite(StringRegExp($string, ':\h*([^:]+)$', 1)[0] & @CRLF)

 

Share this post


Link to post
Share on other sites

haha yes.. thats why i thought V would work since it means anythign non white vertical character

lol

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...