Jump to content
Sign in to follow this  
Lukas

Identify words in characters

Recommended Posts

Lukas

Hello, I want a solution to identifying only the words between certain characters.

Ex:

C:\test1\test2\file.txt

Identify only "test1", "test2" are among "\".

Share this post


Link to post
Share on other sites
taietel

One way is to use RegExp.

Other way, use StringSplit,

$sTest = StringSplit("c:\test1\test2\file.txt","\",2)

MsgBox(64,"","You searched for "&$sTest[2]&" and " &$sTest[3])
Edited by taietel

Share this post


Link to post
Share on other sites
Lukas

Hello, I want a solution to identifying only the words between certain characters.

Ex:

C:\test1\test2\file.txt

Identify only "test1", "test2" are among "\".

Thank you, perfect!

Another question please, in the case below:

test1/test2\test3/test4

Identify only "test2"and "test3", being among different characters "/" and "\"

as would be please?

Edited by LukaS

Share this post


Link to post
Share on other sites
taietel

$sTest = StringRegExpReplace("test1/test2\test3/test4", "\/", "\\")
$aTest = StringSplit($sTest,"\",2)
For $i=0 To UBound($aTest)-1
 ConsoleWrite($aTest[$i]&@CRLF);write to Scite console all the values
Next

Ask if it's unclear. Sorry for the delay, but my internet connection stinks.

Share this post


Link to post
Share on other sites
Lukas

Thank you, perfect!

Another question please, in the case below:

test1/test2\test3/test4

Identify only "test2"and "test3", being among different characters "/" and "\"

as would be please?

Excellent, thanks again!

Share this post


Link to post
Share on other sites
taietel

You are welcome!

One suggestion: when you reply, try to use Add Reply button from the button of the page. This way, the previous post is not copied (unless your intention is to quote, of course).

M.I.

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  

×

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.