it is logically impossible b/c u want to return a piece of
text that
originally wasn't present in the text u r processing. This
operation
requires additional modification/string processing that
recuires more
code aside from pure regex.
On Aug 17, 8:53 am, "Brian E. Dunbar"
<bdun... dunbarconsulting.org>
wrote:
> Thanks. Unfortunately, I don't have the luxury of
concatenating the two
> capture groups. I need the value returned in a single
capture group.
>
>
>
> -----Original Message-----
> From: regex googlegroups.com [mailto:regex googlegroups.com]On Behalf Of
>
> Sergei Z
> Sent: Thursday, August 16, 2007 9:27 PM
> To: Regex
> Subject: Re: Leave something out of a capturing group
>
> if u use
>
> (?:(He)ll(o))
>
> then group #1 will return *He*
> and group #2 will return *o*
>
> and u cannot really split the whole match *hello* [i.e.
group #0] ,
> it'll be there anyway.
>
> On Aug 14, 5:17 pm, brian <bdun... dunbarconsulting.org> wrote:
> > I am trying to match a string and leave part of
the match out of the
> > matching group. For example:
>
> > Source String:
>
> > Hi Hello Hi
>
> > Regex that almost does what I want:
>
> > .*(He(?:ll)o).*
>
> > $1 returns "Hello" and what I want is
"Heo", with the two l's removed
> > corresponding to the non-capturing group.
>
> > Is what I want doable?
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regex googlegroups.com
To unsubscribe from this group, send email to
regex-unsubscribe googlegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---
|