I encountered a grep replace string conundrum this afternoon. I had some strings "ns_", "ms_", or "ns_". I wanted to insert a digit "1" after the "s", i.e., "ns_" > "ns1_", "ms_" > "ms1_", "hs_" > "hs1_". I started to write
Search: ([nmh]s)_ Replace: \11_ … Oops. \11_ looks like sub-string number 11 rather than sub-string 1 followed by a literal 1. My solution was Search: ([nmh])(s)_ Replace: \1s1_ But what if the "s" wasn't there? Suppose I had "n_" > "n1_", etc. How do you add a digit after a saved sub-string? -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
