Jump to content

StringRegExp, same string more then once


Recommended Posts

Hi!

I wrote a little script to demonstrate my problem:

#include <Array.au3>
$sString = "Blablalba" & @CRLF & _
            "Something goes here: coolstuff" & @CRLF & _
            "Blablabla" & @CRLF & _
            "Something goes here: else" & @CRLF & _
            "Blablabla"
$aSRE = StringRegExp($sString, "(?:Something goes here: ([a-z]*))+", 1)
_ArrayDisplay($aSRE)

It creates an array ["coolstuff"].

How can I make it to recognize the other string, so the result would be ["coolstuff", "else"] ?

Link to comment
Share on other sites

Hi!

I wrote a little script to demonstrate my problem:

#include <Array.au3>
$sString = "Blablalba" & @CRLF & _
            "Something goes here: coolstuff" & @CRLF & _
            "Blablabla" & @CRLF & _
            "Something goes here: else" & @CRLF & _
            "Blablabla"
$aSRE = StringRegExp($sString, "(?:Something goes here: ([a-z]*))+", 1)
_ArrayDisplay($aSRE)

It creates an array ["coolstuff"].

How can I make it to recognize the other string, so the result would be ["coolstuff", "else"] ?

Try changing the flag parameter of StringRegExp to global matches, 3.
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...