Jump to content

Recommended Posts

Posted

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 "\".

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
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
Posted

$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.

Posted

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!

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
×
×
  • Create New...