> Hi! Iīm new to regular expressions, and it seems to be an art to make it
> work as expected.
> Iīm trying to remove all "single-line" comments from an string - thatīs
> everything after "//" to the end of a line. I expected that this would do
> the job: ereg_replace("//[[:alnum:]]*\n","",$string), but it didnīt work.
> Any tips?

RegEx can be expensive. Always ask "do I need one?"

In this case, use a string find to locate the // and the following \n (or whatever 
marks the end of line on
your/supported OpSys), then substring or string replace.

If would be quite interesting to see a performance comparison on this - if you've got 

PS if you were working with alpha-text and had to consider upper and lower case, then 
things might sound very

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to