Interesting problem with RegEx Replace - Rapid PHP 14.3

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.

  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;

Interesting problem with RegEx Replace - Rapid PHP 14.3

Postby DaveMorton » Fri Sep 01, 2017 1:31 am

Hi, all. Before I get into my issue, let me give you my specs:

  • OS: Windows 10 Professional, most recent build
  • IDE: Rapid PHP 2016 Version 14.3 (14.3.0.187)

Ok, here's what I'm seeing. If I do a RegEx search/replace for the pattern \_(\W) with the string *\1 it doesn't use the captured group, but instead uses literal \1 instead. However, if I put any character between the asterisk and \1 it works as expected. For example:
  • String to search: "TEST _ TEST"
  • Replacement Regex: \_(\W)
  • Replacement string: _\1
  • Result: "TEST *\1TEST"
  • String to search: "TEST _ TEST"
  • Replacement Regex: \_(\W)
  • Replacement string: _(\1
  • Result: "TEST *( TEST" <-- Please note the space

I haven't tried other RegEx patterns, but I've tried other replacement strings, and the only way I can get the captured group to appear instead of \1 is to place a character between the * and \1, and this is not desireable. The only workaround I've been able to find is to just do a simple (non-RegEx) search for just the underscore and make my replacements by hand. With hundreds of underscores to wade through in my text, in dozens of files, that can get a little tedious.
DaveMorton
 
Posts: 24
Joined: Thu Apr 11, 2013 9:25 pm

Re: Interesting problem with RegEx Replace - Rapid PHP 14.3

Postby pmk65 » Mon Sep 04, 2017 4:52 pm

Im have written a plugin for doing RegEx Search & Replace, as the build-in RegEx Search & Replace is flawed.

If you are interested in testing it out, send me a PM.
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 360
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Support

Who is online

Users browsing this forum: No registered users and 1 guest