Page 1 of 1

replace line based on text in beginning of line

Posted: Thu Dec 08, 2011 5:51 pm
by vinnie_barbarino
I know I need to purchase the reference book, but how would you do the following:

replace a line starting with: <p><a href=

or

replace a block of variable text starting with: <p><a href=
and ending with: </table>

I will buy three licenses if you can show me how this is done.

Posted: Fri Dec 09, 2011 1:42 pm
by ben_josephs
To replace a line starting with <p><a href= :
Search for: ^<p><a href=.*

[X] Regular expression
[ ] "." matches end of line characters [i.e., not selected]

Replace with: [whatever you want to replace it with]
You haven't specified your second question precisely enough. If there is at most one occurrence of <p><a href= and at most one occurrence of </table> in each file, then to replace text possibly containing newlines, starting with <p><a href= and and ending with </table> :
Search for: ^<p><a href=.*</table>

[X] Regular expression
[X] "." matches end of line characters

Replace with: [whatever you want to replace it with]