« first day (594 days earlier)      last day (3198 days later) » 

12:18 AM
!!> 'bla'.match(/a/)
 
1:10 AM
@Jerry: Servy keeps insisting that my solution is wrong, when he didn't check what the whole expression matches
@Jerry The thing is - it works, and if you let the control flow inside (?<-open>, stuffs start to break
 
 
4 hours later…
5:26 AM
The problem is already solved by Kobi when he solved the other harder problem: kobikobi.wordpress.com/2010/12/14/…
The solution was quite simple and easy to understand
 
6:05 AM
lol @CSᵠ You got banned
 
yeah
go figure
i showed him the bot is very vuln to redos and he did that
:P
 
Oh ReDoS, oh ohh ReDoS...
Btw, seen their github ticket?
 
.NET and PCRE have already solved this problem
JavaScript, well, probably use a Worker thread and kill it on TLE?
(Same for other languages without a built-in backtracking limit or time limit)
 
@nhahtdh Nope, I spectated their testing in the sandbox, the bot just freezes
 
So Worker thread doesn't work?
 
6:12 AM
They're not using that.
Though my confusing still exists, whether it is possible to detect, or even better to unfold these problematic regexes?
 
Yes, it is, but it is exponential in worst case, where n is the number of choices to include or exclude in an optional group
 
Whoops, I meant confusion.
 
It's my estimation on my own method to detect catastrophic regex, though
 
@Unihedron i was too lazy to add a ticket, just crashed the bot an notified them on how it's vuln right away
 
Ok, say I have (?:,*|[^,]*)*(?!), what algorithm is related to noticing that this is a bad regex?
 
6:16 AM
Btw, according to doc, Worker thread in JS should solve the problem
@Unihedron It regresses to (,*)*, which is a classic example of catastrophic backtracking
 
@nhahtdh What allows predicting a regression?
 
Or you can "simplify" it to ([^,]*)* - the result is the same
Simply try all cases to drop the optional component
When you get (A*BA*)* or (A*)*, the regex will have catastrophic backtracking
 
That really only rules out ones with high cyclomatic complexity though.
 
Even if it is (A{n1,m1}BA{n2,m2}){n3,m3} where n != m, you can flag it
Or when you get A{n1,m1}A{n2,m2}, it is also problematic
 
And then there's ((?:x*)y*)*.
Where either x or y is a dot or some broad class.
 
6:23 AM
As long as you find A{n1,m1}A{n2,m2}, you can flag it. All the cases above boils down to this
(x*)* --> x*x*...
(A{n1,m1}BA{n2,m2}){n3,m3} --> A{n2,m2}A{n1,m1}
((?:x*)y*)* --> y*y*
 
why not just let it run a certain amount of time?
7
Q: What are PCRE limits?

jostenIn ModSecurity there are PCRE limits exceeded errors. I know I can fix this by setting rules such as: SecPcreMatchLimit 150000 SecPcreMatchLimitRecursion 150000 But, what are these rules actually doing? What does the PCRE limit recursion set to 150,000 mean? What security holes am I allowing...

 
Well, that is the simpler solution, if you are allowing people to exec regex
Detecting problematic regex is more for optimizing the existing code
 
well if the engine doesn't have settings for this, you would to a degree have to understand the regex the same way the engine does
that should be quite some overhead to be done properly
 
Well, my method has been working so far when I check people's regex
 
:D
 
6:31 AM
@nhahtdh any false positives?
 
There should be none, unless the regex is so contrived that it uses some other assertion to make sure catastrophic backtracking can't happen
 
what about A{n1,m1}[_class_including_A_]{n2,m2}
?
 
Yes, it regress to A{n1,m1}A{n2,m2}
 
@nhahtdh where are you using this methos? open source code?
 
@CSᵠ AAAAAAAAAAAAAAAAAAAAAAAB
 
6:33 AM
My brain :P
 
@Unihedron exactly
lkol
 
If I have time, I probably will implement in Prolog first
I think alternation will multiply the exponential by quadratic term
 
hi , could you tell me correct regexp of '----- Reply message -----'
'Reply message' text can be in another language

/---(.*{5, 25})---/
 
@user3212137: Please come back with a more detailed requirement
 
@user3212137 Let me see... So you drop in, give one single test case with no single specification rule, and expect us to have a proper response...
We might be wizards, but we're not mindreaders
 
6:36 AM
we ARE wizards !!!
i have a wand!
 
And I have an IDE.
 
so start with --- and end with --- min 5 chars inside it and max 20 character inside it
 
laser engraved with the characters: RegEx
in that order
@user3212137 what would that look in another language?
 
@user3212137 /-{3}.{5,20}?-{3}/
 
spanish or dutch
 
6:38 AM
well
 
If you know the length, why bother asking us about i18n?
 
works ! thanks
 
bye
 
/-{3,}\s*(Responder mensaje|Reply message)\s*-{3,}/ @user3212137
 
@CSᵠ: OK, now do that for 200+ other locales :P
 
6:39 AM
thanks
:p
 
@nhahtdh :)
 
I'm going to start working on jPCRE and jQtPCRE next month!
 
i like being very strict
 
I also love to do that
And it turns out like this
0
A: Java Regular Expression for detecting class/interface/etc declaration

nhahtdhThis regex is an incomplete specification of Java class and interface declaration. However, it can match declarations like this: abstract class X<B extends Integer,D extends java.io.InputStream,R extends Comparator<? super D>>extends java.util.ArrayList<Integer>implements java.util.Queue<Integer

 
Holy
 
6:41 AM
AWESOME
!
 
Mind = Blown
 
It's not complete, since no recursive regex in Java
But you get the idea
 
deserves upvoted only because of effort writing that
 
I want to put a bounty on that answer
 
@nhahtdh and remember to update it everytime the language changes :D
@Unihedron i started doing java
for android
 
6:43 AM
Still need transient, native, volatile ;)
@CSᵠ Cool :D
 
uploaded a shitty app on my phone
 
xP
 
it's 2.75mb
 
user652649
@nhahtdh LOL
 
@Unihedron: My regex is for class and interface. Those keywords are for methods
 
6:43 AM
i kinda want to throw away java and everything
 
@nhahtdh no fields? :(
 
the app shows a text and a small gif, pointless, simple,,, 2.75mb
 
@nhahtdh no, those keywords are for fields
 
Ah, OK
 
Sorry for confusion ;)
 
6:44 AM
There is also the one for method - synchronized
 
and final
 
No problem, I just confuse myself due to lack of sleep
final can be applied to class
 
Yess and default
 
@nhahtdh also i have an answer exactly in that way: stackoverflow.com/a/15459273/731947
:d
 
Like public final class Pattern <--- **CK
default seems to be a new one from Java 7?
Or is it 8?
 
6:46 AM
And default final class Clazz
6+, prior to that you simply skip the modifier to get, in 1.6 you can use default
so final class Clazz equals default final class Clazz
 
I will probably read about it later - it's a lang feature that I don't use
 
Ha, I was faster than a certain high rep user in competing for the fastest gun on a regex question.
No, I was late by 5 seconds...
 
full house today
 
You killed the chat by pointing that out...
 
you killed it with 'high rep' comparison
 
6:55 AM
^ A certain high rep user
 
he comes by
but is not here now, hmm
and answering quesrions...
hmm
 
There's no "You must participate in chat" rule. :P
 
there should be
 
I don't have time lately to write about regex (there are some answers where I write I will revise, but in the end, I never do after 1-2 days busy doing other stuffs)
 
Should be low
 
479
The title says score per character, but the output is character per score
 
yes I screwed that up
Accidentally on purpose
 
7:23 AM
i got 389
is this good or bad?
 
The less the better, it means you get more score for the less you write
 
hmm, but large-ish answers are encouraged...
 
Well that's if you actually get score for those. Some of my megaposts gets like 1 to two votes where my "quote from documentation" got like 8-9
inb4 rant :)
 
(.*){1,999}K
still killing one of my cpu`s
started running it a few mintes ago
lol
 
There is another class of backtracking catastrophe, where the problem comes from findall functionality + regex starts with catch-all (e.g. .*, [^a])
It multiply the complexity by O(n)
 
7:35 AM
wait, what? js has no possessive ?
^ forgoit how much it sucks
 
On that topic, there is a user vks, who loves to emulate possessive regex with lookahead + backref
I spam possessive regex in Java, especially stuffs like (a|b)*
Without it, a long enough string (1k-2k char) can cause StackOverflowError
 
loves to emulate?
what do you mean by that?
 
Yep
He uses to fix catastrophic backtracking
e.g. (?:a*ba*)* --> (?:(?=(a*ba*))\1)
This technique is introduced by some other user in some post
While it does stop the catastrophic backtracking, I don't like such solution, when an actual solution is available
 
Morning!
 
it's ugly indeed
mornic @IonicăBizău
 
7:47 AM
How to parse things like /users/:user into something like {user: "Someone"}?
/users/Someone => { user: "Someone" } while the rule is /users/:user
 
REST?
 
Also, /users/:user/:age + /users/Someone/20 => { user: "Someone", age: "20" }
@nhahtdh Yes, it's used in REST apis.
(e.g. at GitHub, Express framework etc)
 
Have you check your library/language whether it has built-in support?
 
I'm working with NodeJS, but I don't want to use any other library if that's possible.
I'd like to use a regular expression...
 
Google for "nodejs rest", check out the articles and come back
Writing a regex for these things without knowing the format will give you trouble in the long run when you run into edge cases
 
7:52 AM
Yeah... Then I will choose a library. Thanks!
 
8:03 AM
Anyone has SublimeText3?
Would you please test this answer: stackoverflow.com/a/26302366/1400768
 
Sublime is overpowered.
 
I tested for ST2, but currently don't have access to ST3 to test
 
 
7 hours later…
3:04 PM
holy awesome! A room dedicated to regex eh?
 
@AwalGarg I'm a room owner here as well.
I'm a RO of the best rooms! :D
 
@Unihedron I see, nice
 

« first day (594 days earlier)      last day (3198 days later) »