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

Re: [PBML] substitution + backreferences + function call

Expand Messages
  • da5id
    ... Very cool - I like the option of using e as a regex evaluation option since I can envision myself needing to evaluate a lot as I do the substitution. I
    Message 1 of 3 , Apr 15, 2007
    • 0 Attachment
      > you can use \U: s/\b($keyword)\b/\U$1/gi;

      Very cool - I like the option of using e as a regex evaluation option
      since I can envision myself needing to evaluate a lot as I do the
      substitution. I looked in the Llama book and didn't see this but then
      found a reference in Freidl's Mastering Regular Expressions although it
      missed a complete list. He called it a Case-Folding Span. Are \1 and \U
      the only ones of these?

      Thanks much,

      David


      Randal L. Schwartz wrote:
      >>>>>> "da5id" == da5id <da5id@...> writes:
      >>>>>>
      >
      > da5id> but when I try to use:
      > da5id> s/\b($keyword)\b/uc $1/gi;
      >
      > da5id> I'm getting a literal "uc" rather than the results of the function. Any
      > da5id> suggestions - is my approach a sound one?
      >
      > Well, for "uc" specifically, you can use \U:
      >
      > s/\b($keyword)\b/\U$1/gi;
      >
      > But in general, you can use /e, as in:
      >
      > s/\b($keyword)\b/uc $1/gie;
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.