OK, I've got it.
I modified the expression to un-escape the '\' in front of the 'n'. Your expression worked perfectly with the examples that I gave - which were single quoted strings, but I didn't mention that $foo is actually read from a file and that the \n would be a real newline sequence...
Just noticed that my initial string was double-quoted so that meta-characters are expanded. Should this make a difference as far as the regex is concerned ?
Nick
Yup, I had created a very similar script, except it includes a header for the browser. I just tried yours and it works fine, but mine doesn't. I think I'm not seeing wood for trees - can you spot where I'm going wrong ?
Cheers,
Nick
=============================================...
Hi Dunc,
Nice looking bike - how far away are you ?
Actually I just tried the regex. I may be something I'm doing, but it doesn't seems to work quite right and none of the \n characters are getting replaced with <BR> - even if there are no tags at all in the original input - they all remain as...
Trojan,
OK, I didn't realise I could give a star - but have now done so.
By the way, the offer of the beer was to Duncan, but appears just after your post. However, the more the merrier...
Nick
That makes sense.
If you can get to the George Inn at Croscombe - just outside Wells in Somerset - in the next hour or so - then the beers are on me...
If not, then I'll have one for you ;-)
Thanks again for the help.
Nick
Duncan - you are a true star!
Just to make it more interesting, here's another tweak:
If the \n IS preceeded by 'table>', 'tr>' or 'td>' then, instead of just leaving it as a \n character, it would be better to replace it with a pseudo linefeed - say a string such as '{n}' If I leave the...
Hi Duncan,
Great, thanks for the quick response. One question - will this ignore a linefeed preceeded by any closing tag ? I really just want to ignore table tags.
Thanks,
Nick
Hi,
I have a regular expression that converts newline characters to '<BR>'. I need to modify this so that it only converts the newline characters if they are not preceeded by certain other strings ('table>', 'td>' and 'tr>')
So, examples would be as follows:
original string:
'line1\n line2\n...
Hi Phil,
I'll take a look, but out in meetings most of the day, so might be tomorrow.
Interested in a scoreboard for your golf society? My other hat is as director of Speedtrack Ltd (logistic tracking & event scoring) - MySQL/PHP based of course! And you can update the scores from your mobile...
Phil,
Healthcare huh, never got into that field
Yup, all I need to do now is convince them to convert all the Excel apps to PHP - which is kind of where this all started :-)
I like the idea that you process the files locally with awk and then zip them up and email them - certainly saves...
Hi Phil,
The sad thing is that I can remember the box! I have to say that Wingz was very good for me and I pretty much built the business of the back of it, as for several years it was pretty much the only spreadsheet than ran on Unix and had an interface to real-time data and Informix &...
Hi piquet,
You had Wingz once - jeez, I've never actually come across anyone else that used it apart from clients I - where do you work if can say? Claire Rayner - really - I'm intrigued, and I can understand how that would damage its credibility - we are talking about the Wingz spreadsheet...
Ingresman,
OK, point taken :-) and I have to get on with writing some PHP anyway...
The language is very terse, but extremely powerful, and designed to handle and perform operations and manipulations on scalar and vector data objects very efficiently. For example, you could get the last 100...
Guys,
Can't name the bank as I signed my life away on non-disclosure and confidentiality agreements - and you never know who is reading these posts. Probably being paranoid, but I've seen guys marched out by security within minutes of sending a slightly dodgy email.
Anyway, to get back to the...
Interesting thread. Having previously worked on a variety of applications for an investment bank - to take data from flat-files, rdbms and real-time feeds and then generate integrated reports and charts - I'd go for a non-Excel solution every time these days. The general consencus was that...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.