Jump to content
Sign in to follow this  
gcue

stringregexp help

Recommended Posts

gcue

i am trying to capture "#REO;Cantors-SIM" from this lines of text like this one:

G CN=\#REO;Cantors-SIM3 #REO;Cantors-SIM C

here is what i have so far and am not sure why its not working

$group = StringRegExpReplace($line, ".*5([\S]+)", "")

thanks in advance =)

Share this post


Link to post
Share on other sites
Xenobiologist

Do you some more information? Examples of lines. Shouldn't be that hard to create the correct pattern.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
gcue

here are more examples...

should get #SL Library from

G CN=#SL;Library3 #SL;Library C

should get RMAD from

G CN=RMAD3 RMAD C

should get Socket Data Services from

G CN=Socket;Data;Services3 Socket;Data;Services C

thanks again for your help!

Edited by gcue

Share this post


Link to post
Share on other sites
Xenobiologist

Well, there is no rule, right?

a) Get the words between =\ and ; and ; and 3 or C

B) between = and 3 or C

c) between = and 3 or C without ;

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
gcue

correct. but sometimes theres no "" after CN=

Share this post


Link to post
Share on other sites
Bowmore

This will work for all your examples

$group = StringRegExpReplace($line, "^.* ([S]+) [S]*$", "1")

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
gcue

ur right!! works fantastic

i added this also

StringReplace($group, ";", " ")

thank you very much!

Share this post


Link to post
Share on other sites
Xenobiologist

I had this

$group = StringRegExpReplace($line, ".*?CNW+(.*?)3.*", "$1")


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  

×