Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing whitespace 1

Status
Not open for further replies.

Craigieboy

Programmer
May 25, 2001
71
GB
Can someone tell me what the regular expression would be to remove a single white space from multiple lines?

Here is an example of what the text currently looks like:

0010904 25 Sep 2000
Blah blah blah blah...

0010905 25 Sep 2000
Blah blah blah blah...

0010906 25 Sep 2000
Blah blah blah blah...

I need to remove the single whitespace before the 0010904, 0010905, etc.

I am relatively new to regular expressions. The pattern I have used to find the whitespace followed by 7 digits is
"\s\d{7}\s". There will most likely be a better way of finding the 7 digit number, however this does work.

Can someone tell me what the replace would be, or how to remove that initial single white space?

Many thanks in advance.

Craig
 
If you use the trim command on the result of your regular expression, it should removed leading and trailing whitespaces. Mise Le Meas,

Mighty :)
 
Trim!, of course...

That's it working now - thank you for your help.

Kind regards,
Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top