RE: backreferences in PCRE?

2003-11-14 Thread Ken Ray

> In transcript I thought it should be :
> 
> replaceText(pStr, "([^\\])""e, "$1\""e)
> 
> Which works *except* for the $1 is used literally instead of as a 
> backreference.

That's because only the second parameter of replaceText() is a match
expression; the third param is a simple string.

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/ 


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: backreferences in PCRE?

2003-11-14 Thread Dar Scott
On Thursday, November 13, 2003, at 02:15 PM, Dar Scott wrote:

So tinker with this:

replaceText(pStr, "(?I mean this:

replaceText(pStr, "(?

I forgot what you were trying to do.

Dar

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: backreferences in PCRE?

2003-11-14 Thread Dave Cragg
At 2:15 pm -0700 13/11/03, Dar Scott wrote:

Yikes.  I mean the negative assertion (?

So tinker with this:

replaceText(pStr, "(?Thanks for the pointer, Dar. It looks like this will do it.

  put "(?
  replace quote with "\" & quote in tStr
  replace "\\" & quote with "\" & quote in tStr
At 12:40 pm -0700 13/11/03, Alex Rice wrote:
I can't remember- are any of Rev's REGEX functions capable of doing 
backreferences?
Alex, it seems you can't backreference in the replacement expression 
as in Perl, but you can in the "find" expression, using "\1", "\2", 
etc.

In Perl, I don't think the $1, $2, etc. in the replacement expression 
are strictly regular expression  elements. They are really special 
Perl variables. For example, you can use $1 at anytime after a match 
and it will still hold the matched value.. However, it would be nice 
to have this ability in Rev, but I don't think $1, etc, would work as 
it would clash with Rev's environment variables.

Cheers
Dave
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: backreferences in PCRE?

2003-11-14 Thread Alex Rice
On Nov 13, 2003, at 2:15 PM, Dar Scott wrote:

 I mean the negative assertion (?

So tinker with this:

replaceText(pStr, "(?OK this works: replaceText(pStr, "(?

Thanks Dar! I haven't used assertions much in regex. I'll keep an eye 
on the bug you mentioned. Although these are just small text chunks so 
I don't think it'll effect me.

Alex Rice <[EMAIL PROTECTED]> | Mindlube Software | 


what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: backreferences in PCRE?

2003-11-13 Thread Dar Scott
On Thursday, November 13, 2003, at 02:08 PM, Dar Scott wrote:

I can't remember- are any of Rev's REGEX functions capable of doing 
backreferences?
You might consider the (?<= ) "lookbehind" assertion.

Don't forget the start of the string, too.
Yikes.  I mean the negative assertion (?

So tinker with this:

replaceText(pStr, "(?

Dar Scott

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: backreferences in PCRE?

2003-11-13 Thread Dar Scott
On Thursday, November 13, 2003, at 12:40 PM, Alex Rice wrote:

I can't remember- are any of Rev's REGEX functions capable of doing 
backreferences?
You might consider the (?<= ) "lookbehind" assertion.

Don't forget the start of the string, too.

If you might be matching over 800, see bugzilla 16.  Depending on the 
length of the match, there is a crash when matches get beyond some 
number.

Dar Scott



___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution