Loading ...
Sorry, an error occurred while loading the content.

Re: Another Regex Question... Replacement back references

Expand Messages
  • Rob Springer
    Thanks again! I guess I should have kept reading after, replacement processing is not part of PCRE statement that got me thinking the rest of the help file
    Message 1 of 3 , Nov 5, 2007
    • 0 Attachment
      Thanks again!

      I guess I should have kept reading after, "replacement processing is
      not part of PCRE" statement that got me thinking the rest of the help
      file was only regarding the searching side.

      btw: Finishing the above line is
      The PCRE Syntax Summary page provides a summary of syntax conventions.
      The __Substring Replacements page documents tokens NoteTab__ acts upon
      during regex replacements.

      --- In ntb-scripts@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
      > --- In ntb-scripts@yahoogroups.com, "Rob Springer" <springro@> wrote:
      > >
      > >
      > > I've got a problem where I need to have a number come immediately
      > > after a back reference in the replacement section.
      > >
      > > So the replacement is something like this: $10$8 where it's not
      > > reference $10, but back reference $1 followed by a 0.
      > >
      > > I tried some PHP style grouping like ${1}0${8}, but NTB didn't like
      > > that.
      > >
      > > I also tried named back references, but I'm not sure how to handle
      > > them in the replacement section.
      > >
      > > Any suggestions on how to do this, but I'm going to fix my current
      > > issue by doing a dummy character and then replacing it.
      > >
      > > Thanks,
      > > Rob
      > Hi again,
      > Yes, it would be $1\0$8
      > a backslashed digit in the replacement string is a digit, while $10
      > would be expected to be a backreference. If there is no captured
      > substring number 10, I believe you would get a literal dollar sign 10.
      > Help on NoteTab's replacement string is in the regex.chm under the
      > heading "Substring Replacements"
      > If you used named subpatterns in the pattern, you could get them in
      > the replacement text with $<name>.
      > There are several acceptable ways of naming a subpattern in the
      > pattern, for example (?<name>.+) would name the given subpattern "name".
      > BTW, it might be helpful to know that NoteTab currently has issues
      > with unset subpatterns. Its ok to use something like "(a|b)" where the
      > result goes into one substring, but for example avoid using "(a)|(b)"
      > where one or the other of the subpatterns will be unset for each match.
      > Regards,
      > Sheri
    Your message has been successfully submitted and would be delivered to recipients shortly.