 |
Home:
Perl Programming Help:
Regular Expressions:
Corrected - Please read again: Regexp to remove a matched pattern but...:
Edit Log
|
|

Chupo_cro
Novice

Aug 25, 2012, 5:19 AM
Views: 21325
|
Corrected - Please read again: Regexp to remove a matched pattern but...
|
|
|
Can someone, please, help me to construct the regexp to remove the matched pattern from the string, but to avoid more than one space in the resulting string at the boundaries of the removed substring. All of the remaining substring should stay untouched. Note: The blue text is a condition I forgot to insert in the inital text. Example:
Input: one two some_pattern three four one two some_pattern three four one twosome_pattern three four one two some_patternthree four one two three four some_pattern some_pattern one two three four onetwosome_patternthreefour one two some_pattern three four Desired output: one two three four one two three four one two three four one two three four one two three four one two three four onetwothreefour one two three four
Just removing the from theone two some_pattern three four would result in the stringwhich has two consecutive spaces. Chupo_cro
(This post was edited by Chupo_cro on Aug 25, 2012, 9:34 AM)
|
|
Edit Log:
|
Post edited by Chupo_cro
(Novice) on Aug 25, 2012, 6:39 AM
|
Post edited by Chupo_cro
(Novice) on Aug 25, 2012, 6:42 AM
|
Post edited by Chupo_cro
(Novice) on Aug 25, 2012, 9:30 AM
|
Post edited by Chupo_cro
(Novice) on Aug 25, 2012, 9:34 AM
|
Post edited by Chupo_cro
(Novice) on Aug 25, 2012, 9:34 AM
|
|
|  |