Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Regex to strip comments

by GrandFather (Sage)
on Oct 01, 2012 at 00:36 UTC ( #996560=note: print w/replies, xml ) Need Help??


in reply to Regex to strip comments

In essence you can't do it with a regex without constraining yourself to the simpler cases. You need to parse a fair chunk of the language to be able to distinguish between comments and things that look like comments in other contexts, such as in strings as you have noted already. However dealing with nested comments is tough on regexen and is the real killer.

Note that the regex you give won't work as expected across multiple lines because . doesn't match newline characters unless you use the /s option.

True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996560]
help
Chatterbox?
[marto]: Corion, I think in the past this was a big problem for them. GPU driver wise the improve all the time. I use the open source drivers on my machine (old R9 270, 2GB) and had no problems
[Discipulus]: is not the problem with new hardware?
[marto]: notepad++ ticks all the boxes for me, it's a fine line between just enough, and bloat, in editors for me :P
[marto]: Discipulus]: less so than the modern intel CPUs
[marto]: also, AMD are faster at fixing the CPU microcode it would seem

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-07-27 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (407 votes). Check out past polls.