views:

516

answers:

5

Hi,

Please could someone help me with writing a regex expression to replace 0044 token which will be at the start of the string with a 0. Please note that I do not want to replace all 0044 tokens with 0, only those that appear at the start of the string.

Thanks a lot

+1  A: 

In perl:

s/^0044/0/;

The ^ means that the match will only happen at the beginning of the string.

Graeme Perrow
A: 

I'm trying to acheive it in notepad ++ find and replace selecting the regular expression option...

A: 

Then why you dont put an space at the begining in the search and replace boxes, i mean:

Search: " 0044"
Replace " 0"

Good luck!

David Santamaria
A: 

The ^ works in notepad++ to match the beginning of the line.

Timbo
A: 

If you really want to use regex its already answered above. i.e

Find What: ^0044

Replace With: 0

But here is a crude way to do it:

Press ALT, then select all the '044's vertically using mouse and delete them. Keep ATL pressed while making the selection.

Vivek