List Info

Thread: how to insert characters behind matching expressions




how to insert characters behind matching expressions
user name
2006-06-17 10:01:35
hi, everyone
i want to insert ".jpg" behind the string
"abc", i can set the regular
expression to be ^abc, but how to set the replace parameter,
since i
want the result to be "abc.jpg".


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

how to insert characters behind matching expressions
user name
2006-06-27 19:28:36
wizardyhnr wrote:
> hi, everyone
> i want to insert ".jpg" behind the string
"abc", i can set the regular
> expression to be ^abc, but how to set the replace
parameter, since i
> want the result to be "abc.jpg".

if your string has only three characters, say
"abc", then

pattern:   $
replacement:    .jpg
result:   abc.jpg

If "abc" is just a sub string in another string,
say "the word abc and
def", then you need backreference:

pattern:    (abc)
replacement:  $1.jpg

Note: you may need word boundary in the pattern part to
filter out
changes of cases from like "abcdef" to
"abc.jpgdef".

Xicheng


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )