« first day (773 days earlier)      last day (3019 days later) » 

8:21 AM
*
 
 
3 hours later…
10:56 AM
RTL language in regex is just crazy
 
11:08 AM
Hmmm
Java regex: "(\\Q\u1EBF\\\\E)?+[\\w&&[\\p{L1}]\\p{Z}]+|\\1[\uD835\uDC00-\uD835\uDC33]{1927027271663‌​633,2254527117918231}" w/ Pattern.CANON_EQ
 
11:47 AM
Regex is a write-only language. A few months after writing this "(?=(.*?)(?=(.*))(?<=^(?!.*\\1(?!\\2$)).*))" regex, I don't even know what the heck it is trying to do
 
12:10 PM
33
Q: Provide asking instructions for [regex] (just like for [sql])

Lucas TrzesniewskiYou won't believe this: regex suffers from low-quality questions. First, as you may know, there are several regex flavors is use. The flavor can impact available features, valid syntax or much more obscure subtleties. Except for trivial regex questions (which are probably low-quality anyway), ...

 
12:47 PM
^Nah, people from outside the tag don't do anything. They only vote the meta question
 
Hi..
Why does this return a false ? System.out.println(Pattern.matches("[amn]", "abcd"));
 
^This is the n times someone has asked this
matches asserts that the full string matches the regex
 
Who has asked it n times ?
 
Blame Sun
 
sun ??
 
12:50 PM
^ wild guess, isn't it going to anchor the regex?
 
@HamZa No
 
Any link that tells that the matches asserts that the full string matches the regex ?
 
String.matches/Pattern.matches asserts that the whole string "abcd" matches "[amn]", which is false because [amn] only matches length 1 string
@CodeGeek The doc is not clear, but in String.matches, it says "Tells whether or not this string matches the given regular expression. "
And it also says:
> An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression

Pattern.matches(regex, str)
Anyway, the API has been there from Java 5 (or maybe even in 1.4)
 
let's just say that in Java, matches == completely matches, find == partly matches
 
find() in Java is as powerful as exec() in JavaScript
Actually more, since Java supports API to get indices of the capturing groups
 
12:57 PM
@nhahtdh So how did you master REgex ?
 
@CodeGeek Look at questions on SO, try to write regex. Also look at some answered questions on SO and learn the technique from it.
Anyway, the most important thing is to get an execution model in your head, so you can "run" the regex without a tester
 
Can one learn Regex just by looking at the official doc ?
 
@CodeGeek If you are very intelligent
The things is that you need to understand how the engine work first, then you will know why the result is such as such
3
 
I first learned basics from the Official Doc but I could not understand the quantifier section that led me to a lot of frustation....
 
@CodeGeek Yep - the model. Most engines implements regex by trying every choice and backtrack
(backtracking engine)
Greedy means that it will try the choice of expanding the X first, then try the choice of not to expand X
Lazy will be the reverse
Possessive is somewhat similar to greedy, but as soon as you can't expand X and go on to match the sequel (whatever comes after X), you will not backtrack inside X again
For example a*b versus a*+b on aaaaaaaaaaaaaa
 
1:07 PM
So if I understand it correctly
Greedy - Swallows the entire word/string and matches and if it doesn't find a match it back tracks
Lazy - It stops after a match is found
 
@CodeGeek It's the common understanding, but it's not correct
 
:(
 
a*b on aaaaa will try aaaaa, aaaa, aaa, aa, a, <empty>
a*?b on aaaaa will try <empty>, a, aa, ...
a*+b on aaaaa will try aaaaa only
If your pattern is unambiguous, then using possessive quantifier is the nest
@CodeGeek Try to search on SO for possessive quantifier
I think there is a post with good explanation
 
Got it .. So what is the major difference in a*?b and a*+b ?
 
The reference has become such a mess IMHO...
 
1:18 PM
@HamZa Which one ?
 
262
A: Reference - What does this regex mean?

aliteralmindThe Stack Overflow Regular Expressions FAQ If you want to truly learn regular expressions, then read Jeffrey Friedl's "Mastering Regular Expressions" from beginning to end (3rd edition, on Amazon) Quantifiers Zero-or-more: *:greedy, [*?:reluctant] [Link needed], *+:possessive One-or-more...

 
1:58 PM
can someone help me wtih this pelase
List all env variables that begin with "T" (hint: you'll need a regex that includes the marker of the start of the line) and append them to the end of the file
i need to type the command to terminal
 
2:36 PM
We can teach you how to fish but we are not giving out free tuna
 
 
1 hour later…
3:55 PM
@lovetolearn First think about how you would list all env variables
then you probably want to pipe it to a program which supports regex and then write it to a file
if this is linux, then you probably could use grep
 

« first day (773 days earlier)      last day (3019 days later) »