Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Cadence > Re: SKILL Regul...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 10 Topic 4205 of 4375
Post > Topic >>

Re: SKILL Regular Expression Numbered Register

by Riad KACED <riad.kaced@[EMAIL PROTECTED] > Sep 2, 2008 at 05:02 PM

Hi Jake,

There is some help in this skill do***entation actually. I don't see a
solution for your request though. Let me explain
According to the skill do***ent :

\(=85\): A regular expression wrapped as \( form \) matches whatever
form matches, but saves the string matched in a numbered register
(starting from one, can be up to nine).
\n: A backslash followed by a digit n matches the contents of the nth
register from the current regular expression.

There is an example (From the doc also):

; The target "123 cells" does not begin with a-z/A-Z.
1. rexCompile("\\([a-z]+\\)\\.\\1") =3D> t
2. rexExecute("abc.bc") =3D> t
3. rexExecute("abc.ab") =3D> nil

The compiled regular expression in line 1 would be : "match.match"
the first match will be captured into the memory/register thanks to
the grouping with the parenthesis. This captured match would then be
invoked using the regEx internal variable \1, simple as that. Line 2
evaluates to 't' because the regEx engine manages to find the same
pattern before and after the dot, This pattern was 'bc'.
Try this other example ...
rexCompile("\\([a-z]+\\)\\.\\1.*\\([a-z]+\\)\\.\\2")
rexExecute("ffffoo.foo.totobar.bar")
rexExecute("ffffoo.foo.totobar.camp")

As far as I understand, variables \1, ...\9 are valid in the regular
expression scope only. I don't see any way to print it or assign it to
a regular skill variable as I can do in Perl for example. That's my
personal understanding and I'm might be wrong.

I'm more familiar with regular expressions with Perl. Perl got
variables like $&, $`, $' and $1...9 to print out patterns related to
the matching of regular expressions:
I could run the following Perl command to get the matching from the
1st skill regExp:
PERL> print "$1\n" if $_=3D~m/([a-z]+)\.\1/

That was my understanding so far.

Hope this helps anyway !

Riad.
 




 10 Posts in Topic:
SKILL Regular Expression Numbered Register
Jake <Jakewegman@[EMAI  2008-09-02 10:12:29 
Re: SKILL Regular Expression Numbered Register
Riad KACED <riad.kaced  2008-09-02 17:02:26 
Re: SKILL Regular Expression Numbered Register
Jake <wegman.jake@[EMA  2008-09-03 17:32:00 
Re: SKILL Regular Expression Numbered Register
"S. Badel" <  2008-09-04 13:54:39 
Re: SKILL Regular Expression Numbered Register
Riad KACED <riad.kaced  2008-09-04 11:04:01 
Re: SKILL Regular Expression Numbered Register
Andrew Beckett <andrew  2008-09-05 10:06:04 
Re: SKILL Regular Expression Numbered Register
"S. Badel" <  2008-09-05 11:48:12 
Re: SKILL Regular Expression Numbered Register
pxhxz@[EMAIL PROTECTED]   2008-09-05 12:20:09 
Re: SKILL Regular Expression Numbered Register
pxhxz@[EMAIL PROTECTED]   2008-09-05 12:40:22 
Re: SKILL Regular Expression Numbered Register
Andrew Beckett <andrew  2008-09-10 13:04:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 5:14:48 CST 2008.