|
List Info
Thread: Replace ,_,_,_ ... ,
|
|
| Replace
<Word>,_<Pattern0>,_<Patt
ern1>,_ ... ,<PatternN> |
  United States |
2007-08-31 17:58:26 |
Hello,
I'm looking for an RegEx which replaces
<Word>,_<Pattern0>,_<Pattern1>,_ ...
,<PatternN>
with
<Word> <Pattern0> Literal <Word>
<Pattern1> Literal ... <Word>
<PatternN>
Word is just a single word (not a literal)
,_ is a delimiter (just a ',' and optionally Spaces), not so
important
<Pattern0> ... <PatternN> are always the same
patterns.
Literal is always the same.
Main problem is the correct grouping for the
backreferences.
Thanks and greetings
Udo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Replace
<Word>,_<Pattern0>,_<Patt
ern1>,_ ... ,<PatternN> |
  United States |
2007-08-31 18:02:57 |
This is not possible to my knowledge. The problem is as you
say with
the back references. If you have the following expression
(.)*
and then match it against string
abcde
then back reference 1 will be 'e'. All previous back
references are
lost.
On Aug 31, 4:58 pm, Udo <WeikEng... aol.com> wrote:
> Hello,
>
> I'm looking for an RegEx which replaces
> <Word>,_<Pattern0>,_<Pattern1>,_
... ,<PatternN>
> with
> <Word> <Pattern0> Literal <Word>
<Pattern1> Literal ... <Word>
> <PatternN>
>
> Word is just a single word (not a literal)
> ,_ is a delimiter (just a ',' and optionally Spaces),
not so important
> <Pattern0> ... <PatternN> are always the
same patterns.
> Literal is always the same.
>
> Main problem is the correct grouping for the
backreferences.
>
> Thanks and greetings
> Udo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Replace
<Word>,_<Pattern0>,_<Patt
ern1>,_ ... ,<PatternN> |
  United States |
2007-09-04 05:39:09 |
Hi Udo,
Please try this approach.
Source:
<Word>,_<Pattern0>,_<Pattern1>,_ ...
,<PatternN>
Pattern:
([^,_]+),_([^,_]+),_([^,_]+),_([^,_]+)
Results:
Match <Word>,_<Pattern0>,_<Pattern1>,_ ...
<Word> <Pattern0>
<Pattern1> ...
$1 <Word>
$2 <Pattern0>
$3 <Pattern1>
Thanks
Syd
On Sep 1, 4:02 am, russ <black.russ... gmail.com> wrote:
> This is not possible to my knowledge. The problem is
as you say with
> the back references. If you have the following
expression
>
> (.)*
>
> and then match it against string
>
> abcde
>
> then back reference 1 will be 'e'. All previous back
references are
> lost.
>
> On Aug 31, 4:58 pm, Udo <WeikEng... aol.com> wrote:
>
>
>
> > Hello,
>
> > I'm looking for an RegEx which replaces
> >
<Word>,_<Pattern0>,_<Pattern1>,_ ...
,<PatternN>
> > with
> > <Word> <Pattern0> Literal <Word>
<Pattern1> Literal ... <Word>
> > <PatternN>
>
> > Word is just a single word (not a literal)
> > ,_ is a delimiter (just a ',' and optionally
Spaces), not so important
> > <Pattern0> ... <PatternN> are always
the same patterns.
> > Literal is always the same.
>
> > Main problem is the correct grouping for the
backreferences.
>
> > Thanks and greetings
> > Udo- 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
-~----------~----~----~----~------~----~------~--~---
|
|
[1-3]
|
|