Page 1 of 1

REX Expression

Posted: Thu Mar 28, 2002 12:20 am
by kzinda
If I had two phrases in my document such as "...10,000 cycles of life ..." and "...4.0 life test cycles ..." that I wanted to identify, would I write my REX expression as:

cycle life w/20\digit+

REX Expression

Posted: Thu Mar 28, 2002 9:55 am
by John
I think the query you want is:

cycle life /\digit+ w/20

which looks for "cycle" "life" and a number within 20 characters.

REX Expression

Posted: Sat Mar 30, 2002 11:46 pm
by kzinda
I've tried a similar approach to find number strings such as: 10.sup.-12 units without success. I used the REX expression:

units /[0-9]+\.sup.\[+\-]?[0-9]? w/24

I also tried

units /[0-9]+\.sup.[+\-]?[0-9]? w/24

Both failed. Texis seemed to have problems resolving the [+/-] term.

REX Expression

Posted: Sun Mar 31, 2002 7:12 am
by mark
You forgot the = after .sup.
/[0-9]+\.sup\.=[+\-]?[0-9]+ w/24

When in doubt test with rex on the command line.
rex -x '[0-9]+\.sup\.=[+\-]?[0-9]+'
will show you how it parsed the expression.
echo '10.sup.-12'|rex -p -P '[0-9]+\.sup\.=[+\-]?[0-9]+'
will show you what, if anything, matches.

Also, the w/ operator if fairly irrelevant if your query only has one term as in this case.

REX Expression

Posted: Mon Apr 01, 2002 9:52 am
by kzinda
I do not fully understand why the "=" needs to be added here. Could you explain its use and interpretation here.

And how do I force REX to only accept those hits where the number preceeds the word I am looking for, such as "units" in this example?

REX Expression

Posted: Mon Apr 01, 2002 10:40 am
by mark
= means exactly one of the previous subexpression. ie {1,1}
Without it you're saying, in this case, 0 or 1 of .sup.[+-]

[0-9]+\.sup\.=[+\-]?[0-9]+ units