i have some text files that contain
<img width="100" or
<img width="1400" or….
How could i replace all above with the following, since the image width is not static?
<img width="200"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a regular expression based solution you could use this:
It will work if your files are from a trusted source in a format that you control. If not and this is HTML, you might want to look at a HTML parser such as HTML Agility Pack.
If the files are too large to read into memory you might want to handle the file one line at a time.
It can also sometimes be a good idea to write to a temporary file and only delete the original file once you are sure that the write has succeeded.