« first day (9 days earlier)      last day (5131 days later) » 
00:00 - 22:0022:00 - 00:00

22:07
@GeorgeEdison \o/
...and that one includes the fix for the links when sorting by code size problem.
22:23
Any RegEx people around?
I've got a really confusing one.
/^(?<!#.+)\r$/gs
I know, I know... it looks like Perl...
From www.myregextester.com:
Match Pattern Explanation:
MATCH PATTERN ERROR.
What are you trying to do?
It's bad, I know...
JB
JB
Where does that come from?
...I'm trying to match lines that don't start with '#'
...but I think I've got it.
JB
JB
Remove that <
22:29
/^(?!#).+$/gs
^--- That works.
...sort of.
I need to match the newline is what I really need.
JB
JB
match or capture?
Just match.
I don't need anything captured.
JB
JB
I must be missing context--why the /gs?
Oh, never mind that.
That's not part of the RegEx itself.
(That's what wraps the expression in JavaScript.)
Here is what I have now: ^(?!#.+)$\r
I just want to match the newline.
I gotta go really shortly, but I do know regex and I can help you when I get back.
22:34
Can't you just use /\n/?
errr
Ya, but it should only match newlines that end a line that didn't start with a '#'
JB
JB
the fine art of asking questions :)
@GeorgeEdison Yummy. I know (most) regex. And Perl. I may be of some use.
you're going to need a literal "\n"
because "." by default won't match a newline.
JB
JB
that /s tends to make me think otherwise, but he won't admit it's there
I don't think javascript has /s does it?
JB
JB
22:41
dunno
Nope, javascript has no modifier s for regex
JB
JB
just /gim in the page I found
I'm confused.
0
Q: RegEx to match only a newline character with given conditions?

George EdisonI have the following RegEx: ^(?!#)(?<=.+)$\r (with the global and multiline flags set) What I want to do is match a newline only when it ends a line that doesn't start with '#'.

You can't just say "regex" , there's multiple flavours >_>
you have to specifiy "JavaScript" in your question if you want it to work in Javascript.
Well, then we'll say PECL for now.
...or JavaScript, yeah.
There, I retagged the question.
22:52
/(^#.*\n)/mg; # the basics of what is needed.
@Kent: Thanks!
that other stuff you're doing looks needlessly fancy.
P.S., if you need a good testing tool for RegEx, I humbly recommend RegExr.
That's what I'm using for testing this all out.
For regex testing, I just put the regex in the code and run it =P
Whatever works.
22:55
In your case, its list of stuff and various regex tricks to drop in seem to be confusing =P
Lookbehind/Lookahead are generally "non-capturing"
23:07
@GeorgeEdison jsfiddle.net/kentnl/aLPNQ/1 # I believe this is what you are trying to do
Javascript Regex Doesn't support "lookbehind", so you'll need to use capturing in the subsitution.
@Kent: Thanks... but I kind of wanted the opposite.
I want to replace the newlines on all lines except for the lines that start with '#'.
you just want to eleminate comment lines? =)
oh. right.
/me ponders
The sample in this case is C++ code.
I want to 'minify' it but I can't get rid of newlines if that line is a preprocessor block.
...and they start with '#'.
The guy who wrote a comment here had a great idea...
> "I'd be tempted to .split on newline, iterate through the array and add a newline to anything not starting with # and then .join"
@GeorgeEdison Use a real parser, rather than regexes. :-P
That's just crazy talk
23:19
jsfiddle.net/kentnl/aLPNQ/2 # theres a start :/
you can't just split on newline, because splitting wont capture the terminator.
Well, I guess you can, its just different >_>
but you have to become jquerysexual to use ^ that code.
jQuery.map()... I like that.
23:57
I found a jQuery bug!
And I was just starting to respect you...
See for yourself.
It actually yanks off a linebreak after the first line.
I don't see how thats a bug.
23:59
It's not supposed to remove line breaks halfway through the string.
00:00 - 22:0022:00 - 00:00

« first day (9 days earlier)      last day (5131 days later) »