This is the first time I have tried to use rxregexp, and I'm obviously
misunderstanding something.
Here's the pertinent bit of code I've written:
| say '-' ~ copies(80)
| say "partLine["L"] = '"partLine[L] ~ left(60)"...'"
| say " pattern["1"] = '"pattern[1]"'"
| call trace ?i
| if regexp ~ parse(pattern[1]) = 0 then
| if regexp ~ match(partLine[L]) then
| do
| starts = pos(partLine[L])
| ends = position(partLine[L])
|
| if starts+ends > 0 then
| partLine[L] = partLine[L] ~
replaceAt(replacement[1],starts,ends-starts+1)
| end
| call trace n
and trace output from a few lines of input:
|
--------------------------------------------------------------------------------
| partLine[L] = '<a id="p0" name="p0"></a><p onmouseover="PNo(0)"> </p>
...'
| pattern[1] = '<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">'
| >>> "?N"
|
| 197 *-* if regexp ~ parse(pattern[1]) = 0
| >V> REGEXP => "a RegularExpression"
| >V> PATTERN => "an Array"
| >L> "1"
| >A> "1"
| >M> "[]" => "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >A> "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >M> "PARSE" => "0"
| >L> "0"
| >O> "=" => "1"
| >>> "1"
|
| 197 *-* then
| 198 *-* if regexp ~ match(partLine[L])
| >V> REGEXP => "a RegularExpression"
| >V> PARTLINE => "an Array"
| >V> L => "3"
| >A> "3"
| >M> "[]" => "<a id="p0" name="p0"></a><p
onmouseover="PNo(0)"> </p>"
| >A> "<a id="p0" name="p0"></a><p
onmouseover="PNo(0)"> </p>"
| >M> "MATCH" => "0"
| >>> "0"
|
| 206 *-* call trace n
| >V> N => "N"
| >A> "N"
|
--------------------------------------------------------------------------------
| partLine[L] = '<a id="p1" name="p1"></a><p onmouseover="PNo(1)">The
ticking...'
| pattern[1] = '<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">'
| >>> "?N"
|
| 197 *-* if regexp ~ parse(pattern[1]) = 0
| >V> REGEXP => "a RegularExpression"
| >V> PATTERN => "an Array"
| >L> "1"
| >A> "1"
| >M> "[]" => "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >A> "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >M> "PARSE" => "0"
| >L> "0"
| >O> "=" => "1"
| >>> "1"
|
| 197 *-* then
| 198 *-* if regexp ~ match(partLine[L])
| >V> REGEXP => "a RegularExpression"
| >V> PARTLINE => "an Array"
| >V> L => "4"
| >A> "4"
| >M> "[]" => "<a id="p1" name="p1"></a><p
onmouseover="PNo(1)">The ticking ...
| |
--------------------------------------------------------------------------------
| partLine[3] = '<a id="p0" name="p0"></a><p onmouseover="PNo(0)"> </p>
...'
| pattern[1] = '<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">'
| >>> "?N"
|
| 197 *-* if regexp ~ parse(pattern[1]) = 0
| >V> REGEXP => "a RegularExpression"
| >V> PATTERN => "an Array"
| >L> "1"
| >A> "1"
| >M> "[]" => "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >A> "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >M> "PARSE" => "0"
| >L> "0"
| >O> "=" => "1"
| >>> "1"
|
| 197 *-* then
| 198 *-* if regexp ~ match(partLine[L])
| >V> REGEXP => "a RegularExpression"
| >V> PARTLINE => "an Array"
| >V> L => "3"
| >A> "3"
| >M> "[]" => "<a id="p0" name="p0"></a><p
onmouseover="PNo(0)"> </p>"
| >A> "<a id="p0" name="p0"></a><p
onmouseover="PNo(0)"> </p>"
| >M> "MATCH" => "0"
| >>> "0"
|
| 206 *-* call trace n
| >V> N => "N"
| >A> "N"
|
--------------------------------------------------------------------------------
| partLine[4] = '<a id="p1" name="p1"></a><p onmouseover="PNo(1)">The
ticking...'
| pattern[1] = '<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">'
| >>> "?N"
|
| 197 *-* if regexp ~ parse(pattern[1]) = 0
| >V> REGEXP => "a RegularExpression"
| >V> PATTERN => "an Array"
| >L> "1"
| >A> "1"
| >M> "[]" => "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >A> "<a id="p[0-9]+" name="p[0-9]+"></a><p
onmouseover="PNo\([0-9]+\)">"
| >M> "PARSE" => "0"
| >L> "0"
| >O> "=" => "1"
| >>> "1"
|
| 197 *-* then
| 198 *-* if regexp ~ match(partLine[L])
| >V> REGEXP => "a RegularExpression"
| >V> PARTLINE => "an Array"
| >V> L => "4"
| >A> "4"
| >M> "[]" => "<a id="p1" name="p1"></a><p
onmouseover="PNo(1)">The ticking...
| >A> "<a id="p1" name="p1"></a><p onmouseover="PNo(1)">The
ticking...
| >M> "MATCH" => "0"
| >>> "0"
|
| 206 *-* call trace n
| >V> N => "N"
| >A> "N"
If I'm reading the descriptions of the .RegularExpression methods right
these should
work, but since they don't, where am I going wrong?
Leslie
--
Platform: Linux
Distribution: openSUSE Leap 15.6 - x86_64
Open Object Rexx Version 5.0.0 r12583
Build date: Dec 23 2022
Addressing mode: 64
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users