Jump to content
gcue

stringregexp match

Recommended Posts

gcue

hello

i am trying to pull the test from this line but i am just getting Last Keyword XMP

$string = "Last Keyword XMP                : test"
ConsoleWrite(StringLeft(StringRegExpReplace($string, "Last Keyword XMP.*?(\d.+)", "$1"), 16) & @CRLF)

thank you in advance!

Share this post


Link to post
Share on other sites
iamtheky
$string = "Last Keyword XMP                : test"
ConsoleWrite(StringRegExp($string , "\s+:\s+(.*\z)" , 3)[0] & @CRLF)

 


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

Share this post


Link to post
Share on other sites
iamtheky

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
gcue

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
mikell

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
gcue

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.