Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/__core.init.php on line 814

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/sessions/_sessions.init.php on line 268

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_blog_main.inc.php on line 507

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 135

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 139

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 147

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 154

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 201

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 207

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 235

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 250

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 261

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php on line 273

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/files/model/_file.funcs.php on line 583

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_connect_db.inc.php on line 29

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/_param.funcs.php on line 1739

Warning: Cannot modify header information - headers already sent by (output started at /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php:147) in /data/14/0/3/50/981702/user/1012017/htdocs/inc/sessions/model/_session.class.php on line 222

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_item.funcs.php on line 114

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/model/dataobjects/_dataobject.class.php on line 417

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/model/dataobjects/_dataobject.class.php on line 433

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/model/dataobjects/_dataobject.class.php on line 442

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_item.class.php on line 1877

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_item.class.php on line 3546

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_itemlist.class.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_itemlistlight.class.php on line 118

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_itemlistlight.class.php on line 178

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/items/model/_itemlistlight.class.php on line 833

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/inc/generic/model/_genericelement.class.php on line 109

Warning: Cannot modify header information - headers already sent by (output started at /data/14/0/3/50/981702/user/1012017/htdocs/inc/_main.inc.php:147) in /data/14/0/3/50/981702/user/1012017/htdocs/inc/_core/_template.funcs.php on line 59

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 597

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 610
Regex!
« Social NetworksA Scattered Update »

Regex!

08/04/10 | by Phillip [mail] | Categories: technology

xkcd: Regular Expressions

I've put off for a long time learning regular expressions because they looked so complicated. Then this summer I ran up against them in my job. And it turns out that they actually aren't quite as alien as it seemed at first glance. Not just that, but now that I've learned how to use them, I find myself using them more and more. Instead of using a built in function to do string parsing like parse_url(), I find that doing it myself gives better and more controlled results. Instead of bending to suit the requirements of the built-in function, I just add a ? to my regex and poof - who cares if there's a protocol on that URL or not? If you've been putting off learning regex because it looks intimidating - go do it - it's worth it.

/.*/

PS. For PHP see preg_match() and other functions in that family.



Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/skins/_item_feedback.inc.php on line 156

No feedback yet


Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/skins/_item_comment_form.inc.php on line 71

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/skins/_item_comment_form.inc.php on line 115

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

You can just use your OpenID to provide your name, e-mail and url.


Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/plugins/_calendar.plugin.php on line 184

Deprecated: Assigning the return value of new by reference is deprecated in /data/14/0/3/50/981702/user/1012017/htdocs/plugins/_calendar.plugin.php on line 909
May 2012
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Hi - I'm Phillip and this is my place to talk about whatever it is that crosses my mind. I'm a geek, and proud of it. I'm also into woodworking, especially boxes. I'm now a junior at Virginia Tech.

FriendConnect

Search

XML Feeds

open source blog software