I am new to regex. I use an Android text editor with regex feature for search and replace. The application has dialog for search string and replacement string. It works wonderfully.
I have a list of 10 words with 10 words for replacement. Can regex do the replacements in one go? For example, search for: (aa), (bb). Replace with: xx, yy. Thanks
As a newbie, I don't know where to start. But I have my PHP codes to do that if regex couldn't. I also know, a macro in Word could accomplish the task.
I want to replace month in number to month name. E.g.
3forMarch,5forMayetc. After a lot of trial and error, I came up with this solution.I read the text line by line. Add this to that line.
..1,Jan;2,Feb;3,Mar;4,Apr;5,May;6,Jun;7,Jul;8,Aug;9,Sep;10,Oct;11,Nov;12,DcSave.
Read the file again line per line. Search for that month in number. Fortunately, in my case, the place of the month is fixed. It is after the day. The format bring
DD-MM-YYI just search:
(\<div.+mid\"\>\d{1,2})\-(\d{1,2})\-(.+)(\<\/div\>).+?(?=\2)\d{1,2}, (\w+)And replace with
$1 $5 $3$4Explanation:
\-(\d{1,2})\-This is the second group captured..+?(?=\2)\w÷.\d{1,2},(\w+)You may have to remove the trailing month names. Easy.