Jump to content

StringRegExp [] Help


McGod
 Share

Recommended Posts

I need something that will go [0-9:;+'] (Like 0,1,2,3,4,5,6,7,8,9,:,;,+,') In a StringRegExp bracket, but it doesnt work:( Can anyone figure out a way of doing it?

Link to comment
Share on other sites

  • Moderators

I need something that will go [0-9:;+'] (Like 0,1,2,3,4,5,6,7,8,9,:,;,+,') In a StringRegExp bracket, but it doesnt work:( Can anyone figure out a way of doing it?

Do you have an actual string to work with an an example output desired?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Im trying to parse a ÿc1 string, the 1 is the character im trying to get, although it could be anywhere within a string like

Example

ÿc5 ]]]]]]]]]] Preserved Head ÿc;-

Which I would parse to be able to get

the 5 and ; in the array.

I've tried

Local $sStats = StringRegExp($sStat[$i], "(?i)ÿc[0-9][;][:][+][']", 1, 1)

Local $sStats = StringRegExp($sStat[$i], "(?i)ÿc[0-9;:+']", 1, 1)

Local $sStats = StringRegExp($sStat[$i], "(?i)ÿc[0-9][;:+']", 1, 1)

Link to comment
Share on other sites

  • Moderators

Try this:

#include <array.au3>
$sString = "ÿc5 ]]]]]]]]]] Preserved Head ÿc;-"
$aSRE = StringRegExp($sString, "(?s)(?i)ÿc(\d+).+?(;|'|:|\+)", 3)
_ArrayDisplay($aSRE)

Edit:

Or this expression:

#include <array.au3>
$sString = "ÿc5 ]]]]]]]]]] Preserved Head ÿc;-"
$aSRE = StringRegExp($sString, "(?s)(?i)ÿc(\d+).*?ÿc(;|'|:|\+)", 3)
_ArrayDisplay($aSRE)
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

<_< it works:) Big thanks!
Link to comment
Share on other sites

Do you have an actual string to work with an an example output desired?

Another Example for you to lookat

#include <array.au3>
Dim $sString = " ÿc4]]]]ÿc:]]]]]ÿc+] Preserved ÿc5 Head ÿc;-"
Dim $sPattern = "(?:ÿc([0-9:;+']))"
Dim $aResult = 0
$aResult = StringRegExp($sString,$sPattern,3)
_ArrayDisplay($aResult)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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