Sign in to follow this  
Followers 0
Lukas

Identify words in characters

7 posts in this topic

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



#2 ·  Posted (edited)

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

#3 ·  Posted (edited)

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

$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

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

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

Thank you and grateful for the suggestion! :x

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  
Followers 0