Find and replace lines prefixed with a specific character
Posted: Thu Jan 02, 2014 6:08 pm
Hi,
I'm new at regular expressions and need a little help to get started. I have several plain text files that contain multiple lines. Some of those lines start and end with a specific character. This could be an asterisk or a letter.
Here's an example:
Polly wants a cracker
Oswald has a cookie but does not share with others
b Carmen goes to school with a lunchbox full of treats b
Michelle doesn't eat potato chips
I would like to find the sentences that have leading and ending characters and remove those. So in the example I'd like to find the sentence b Carmen goes to school with a lunchbox full of treats b and remove the b in the beginning and end of the line.
Can anyone help me with the regex for this?
I'm new at regular expressions and need a little help to get started. I have several plain text files that contain multiple lines. Some of those lines start and end with a specific character. This could be an asterisk or a letter.
Here's an example:
Polly wants a cracker
Oswald has a cookie but does not share with others
b Carmen goes to school with a lunchbox full of treats b
Michelle doesn't eat potato chips
I would like to find the sentences that have leading and ending characters and remove those. So in the example I'd like to find the sentence b Carmen goes to school with a lunchbox full of treats b and remove the b in the beginning and end of the line.
Can anyone help me with the regex for this?