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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex help please 1

Status
Not open for further replies.

audiopro

Programmer
Joined
Apr 1, 2004
Messages
3,165
Location
GB
I am reading info from a text file and displaying it on a web page. The original brief was to put a line break after each full stop in the text.
Using:-
Code:
$ad_res[2] =~ s/\./.<br>/g;
How can I make it ignore the regex if there is a number before and after the full stop (ie 1.4 million)?

Keith
 
maybe this is good enough:

Code:
$ad_res[2] =~ s/\.(?!\d+)/.<br>/g;
 
Thanks Kevin - that works a treat but could you please explain how the (?!\d+) portion works.

Keith
 
Thanks - a bit of heavy going there but I have learned some useful new stuff.
For the benefit of archive - the replacement is not carried out if the full stop is directly followed by a digit.

Keith
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top