Jump to content

String Split


Recommended Posts

Hi,

I have a String Like this: 

$String = 'Numbers:1234567890Letters:abcdefghi'

Now, I want:

1) Search for the : in the String. (In this case there are 2 matches.)

2) Get the text atfer teh 1 occurence of until the second occurence. Would be in this case the green marked part.

  

$String = 'Numbers:1234567890Letters:abcdefghi'

3) Save this text in avariable for later usage.

4) Replace the green text with 'HELLO'

5) Remove the two : 's

6) Display final String in a messagebox.

Not sure how to do this without Regex? :/ How can I acomplish this with StringReplace etc?

Link to comment
Share on other sites

output:

1234567890Letters
NumbersHELLOabcdefghi

$String = 'Numbers:1234567890Letters:abcdefghi'
$Stringa = StringRegExpReplace($String, "(.*:)(.*)(:.*)","$2")
$Stringb = StringRegExpReplace($String, ":.*:","HELLO")
ConsoleWrite($Stringa & @CRLF)
ConsoleWrite($Stringb & @CRLF)
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...