Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Problems

Name: Anonymous 2009-03-27 18:57

Does anyone else who doesn't work with regular expressions on a regular basis feel like a champ whenever they write one successfully?  (self.programming)
83 points posted 4 hours ago by benihana 86 comments share save hide report

benihana 24 points 3 hours ago* [-]
↓ I'm a web developer and I rarely use regular expressions. But when the need to use one does arise,
   and I write one that does what I expect without having to consult anything, I feel like I just
   discovered general relativity. Anyone else feel a great sense of triumph over the natural,
   unordered chaos of text?
   permalink report reply

Name: Anonymous 2009-03-27 18:59

Yes, Reddit sucks now. That's not news.

Name: Anonymous 2009-03-27 19:02

i feel a great sense of triumph when i cum on a womans face

Name: Anonymous 2009-03-27 19:03

Post your longest regex ITT:
Pattern pattern = Pattern.compile("^!("+options+")(([a-zA-Z0-9&' ]+)(\\s*(-\\s*((\\d+)\\s+)?([a-zA-Z0-9]+)?)?(\\s*\\((\\d+):(\\d+)\\))?(\\s+(\\d+)\\s*)?(\\s*:\\s*([a-zA-Z0-9 ]+))?)?)?",Pattern.CASE_INSENSITIVE);

Name: Anonymous 2009-03-27 19:05

"Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems."

Name: Anonymous 2009-03-27 19:24

Regees are so fucking easy, the only people posting this I TOTALLEE FEEL LIKE A GEENYUS WHEN I GET IT RIGHT bull crap are people who don't know regexes.

Name: Anonymous 2009-03-27 19:27

>>4
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
 \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
 \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[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r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\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\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
 \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*)

Name: Anonymous 2009-03-27 19:29

>>7
valid perl code

Name: Anonymous 2009-03-27 19:31

>>8
christopher@chrislaptop$ perl ./valid.pl
Unmatched ( in regex; marked by <-- HERE in m/:( <-- HERE / at ./valid.pl line 1.

Name: Anonymous 2009-03-27 19:41

regexes are easy, what is this person talking about?
she must be the type of person who always keeps a desk reference at arm's length when writing code

Name: Anonymous 2009-03-27 19:45

>>4
you realize [a-zA-z0-9] could be [^\W_], right?

Name: Anonymous 2009-03-27 19:48

>>9
Did you remove the line breaks, Christopher-san?

Name: Anonymous 2009-03-27 20:05

>>11
you do realize that [^\W_] could be (?:(?i:[abcdefghijklmnopqrstuvwrxyz])|[0123456789]),right?

Name: Anonymous 2009-03-27 20:27

>>3
Too bad it has never happened and never will happen.

Name: Anonymous 2009-03-27 20:27

>>7
What is this doing?

Name: Anonymous 2009-03-27 20:33

>>15
Random guess: it's the email validation one.
Whenever regular expressions are mentioned some unoriginal person always feels the need to either paste it or link to it.

Name: Anonymous 2009-03-27 21:01

this thread has two problems

Name: Anonymous 2009-03-27 22:38

Name: Anonymous 2009-03-27 22:40

>>18
d^_^ Upmodded for Xkcd reference

Name: Anonymous 2009-03-27 22:54

ever since i read Mastering Regular Expressions i have been unable to control myself, i use regexes for everything.
chomp? who needs chomp? i'll use a regex! FUCK YEAH!

Name: Anonymous 2009-03-27 23:18

>>20
You actually read the whole thing? Jesus christ. I can understand a two page tutorial; hell thats about the cumulative amount of documentation on using regex that I have read. (Obviously excluding things particular to a specific implementation like class names for java, delimiters for .js etc..) I have no fucking clue how or why anybody would need 368 pages to learn regular expressions; except perhaps the author and publisher of that book.

Name: Anonymous 2009-03-27 23:23

>>21
to write OPTIMISED expressions, ofcourse

Name: Anonymous 2009-03-27 23:40

>>22
The idea of optimizing a regular expression is just plain ludacris. The only actual optimization possible is if you have a situation where a possessive quantifier can be used, and the amount of times that happens are slim to none. What's more, you learn about possessive quantifiers from a two page tutorial anyway. In conclusion: sage.

Name: Anonymous 2009-03-27 23:49

>>23
well some people like to finish reading books that they start.

Name: Anonymous 2009-03-28 0:01

>>24
I was really implicitly asking why you would buy it in the first place as opposed to why you would read it, although admittedly the two go hand in hand with some slightly differing consequences.

Name: Anonymous 2009-03-28 0:25

>>19
Added to my friend list

Name: Anonymous 2009-03-28 0:26

>>5
>>17
EXPERT JOKE EXPLAINERS

Name: Anonymous 2009-03-28 0:35

>>25
You can get books freely on the internet you know.

Name: Anonymous 2009-03-28 0:55

>>28
Yes, but then there is no real guilt by a reader for not finishing the book because they didn't spend any money on it.

Name: Anonymous 2009-03-28 2:13

>>21
I, too, own this book, and I, too, read it cover to cover. The nice things about books like that is that they also cover obscure cases or rationales that two-page tutorials wouldn't.

It's still not worth the €50 I paid for it, though.

Name: Anonymous 2009-03-28 8:10

>>30
That's the price you pay for a specialist book. It happens all the time for specialist shit that shouldn't cost so much.

Name: Anonymous 2009-03-28 10:32

Name: Anonymous 2009-03-28 12:06

  up votes    753
down votes    373

Name: Anonymous 2009-03-28 12:07

test

Name: Anonymous 2009-03-28 12:29

>>34
Sorry it didn't work

Name: Anonymous 2010-11-26 16:53

Name: Anonymous 2011-02-03 1:40

<

Name: Anonymous 2011-02-04 13:44

Don't change these.
Name: Email:
Entire Thread Thread List