Jump to content

StringRegExpReplace back references


Zaxon
 Share

Recommended Posts

StringRegExpReplace backreferences don't seem to allow functions to be applied to them.

Let's check if back references are working:

$string="hello"
$string=StringRegExpReplace($string,"(.)","=$1")
msgbox(0,"",$string)

; produces: =h=e=l=l=o

So, the asc function is being applied FIRST and acts on the literal string "$1" rather than the back reference which will be substituted into it.

Is there a way to use functions on back references - like you can in most other languages? If not, then StringRegExpReplace becomes practically useless except for the classic delete pattern: stringRegExpReplace($string,"something here","")

Link to comment
Share on other sites

OK. The outcome of that thread seems to me to be: applying functions to back references totally fails. Use some other workaround instead, perhaps some combination of StringRegExp then manually replacing what you've found.

So the upshot is that AutoIt's StringRegExpReplace is only usable for the simplest cases. Are there some plans to fix this to make it more usable?

Link to comment
Share on other sites

  • Moderators

OK. The outcome of that thread seems to me to be: applying functions to back references totally fails. Use some other workaround instead, perhaps some combination of StringRegExp then manually replacing what you've found.

So the upshot is that AutoIt's StringRegExpReplace is only usable for the simplest cases. Are there some plans to fix this to make it more usable?

Download the PCRE engine, get the exact/correct syntax ... if it works there... then it will work here too.

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.

Link to comment
Share on other sites

Download the PCRE engine, get the exact/correct syntax ... if it works there... then it will work here too.

If you're refering to PCRE 7.4 as in http://freshmeat.net/projects/pcre/?branch...lease_id=262222 which is an external library, our problem isn't so much with the internal processing of the regex, but rather that AutoIt parses the statement and evaluates it before it can be plugged into the PCRE.

And I've already given an example showing that it doesn't work as it is in AutoIt. Testing out an underlying library isn't go to solve the AutoIt side of things.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...