Jump to content
Sign in to follow this  
c.haslam

StringRegExp with repeating group

Recommended Posts

c.haslam

I have a string that contains a number of tabstops. Each tabstop has a position, a kind (left, right, centre, decimal) and sometimes a leader. So the string might look like "1.5r_4c=", and so on.

So each tab has the syntax <number><l|c|r|d><.|-|_|t| > where | means or .

I have

$a = StringRegExp("2.4c=15r ","([0-9.]{1,}[lcrd][\,\_\=\t ])*",4)
$s = ""
For $i = 0 To UBound($a)-1
    $b = $a[$i]
    For $j = 0 To UBound($B)-1
        $s = $s&$b[$j]&"|"
    Next
Next
MsgBox(0,"",$s&@error&"|"&@extended)

What expression can I use if the last character, the dot leader, is optional, i.e. it is left off if there is no dot leader?


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
SmOke_N

I have a string that contains a number of tabstops. Each tabstop has a position, a kind (left, right, centre, decimal) and sometimes a leader. So the string might look like "1.5r_4c=", and so on.

So each tab has the syntax <number><l|c|r|d><.|-|_|t| > where | means or .

I have

$a = StringRegExp("2.4c=15r ","([0-9.]{1,}[lcrd][\,\_\=\t ])*",4)
$s = ""
For $i = 0 To UBound($a)-1
    $b = $a[$i]
    For $j = 0 To UBound($B)-1
        $s = $s&$b[$j]&"|"
    Next
Next
MsgBox(0,"",$s&@error&"|"&@extended)

What expression can I use if the last character, the dot leader, is optional, i.e. it is left off if there is no dot leader?

Use the left to right one followed by center and a kick in the ass by the right one.

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.

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  

×