How to replace only part of a regular expression??
Posted: Fri Nov 01, 2013 1:08 am
Hi all,
I'm cleaning text files that were scanned and digitally converted to txt files, and I'm attempting to search for commas in the files that accidentally became digitally converted to periods. For example:
The person. who was terribly exhausted, took a nap.
I want to replace the period after "person" to a comma, so I'm using (\. )[a-z] to find that specific instance. However, when I try to replace with a comma, the entire expression replaces and so the sentence becomes "The person, ho was terribly exhausted, took a nap." As you can see, in searching for [a-z], that first letter of the next word also is replaced.
Is there a way to get around this so that I can search only for instances where a lowercase letter follows a period, but retain the full word that follows the period and space? Thank you!!!
I'm cleaning text files that were scanned and digitally converted to txt files, and I'm attempting to search for commas in the files that accidentally became digitally converted to periods. For example:
The person. who was terribly exhausted, took a nap.
I want to replace the period after "person" to a comma, so I'm using (\. )[a-z] to find that specific instance. However, when I try to replace with a comma, the entire expression replaces and so the sentence becomes "The person, ho was terribly exhausted, took a nap." As you can see, in searching for [a-z], that first letter of the next word also is replaced.
Is there a way to get around this so that I can search only for instances where a lowercase letter follows a period, but retain the full word that follows the period and space? Thank you!!!