Question: I have problem with the following perl command
How to match all "1234" strings in file, but if some characters jointed before "1234" then it will not match, my problem is: if the string "1234" in the middle of the line then it not match why?

The perl command:

```
perl  -pe 's/OLD/NEW/ if /^1234/' file

```

Example of what need to match:

```
a ass 1234= OLD
bbb ddd 1234= OLD
 1234= OLD

```

Example of what not need to match:

```
a1234=  OLD
sss q1234=  OLD

```

Answer: 
Change the `^` to `\b`. That will match only if the `1234` is the start of a word. (If necessary, see `perldoc perlre` for more information on what constitutes a 'word'!)
The `^` matches "the beginning of the line". Try removing that character in the regular expression. Replace it with a space character.