RSS feed [root] /misc /weblog




login:

password:

title search:




 


Thu Jul 13 15:54:32 HKT 2017

regex



Short tips of regex - http://immike.net[..]know-to-become-a-regular-expression-pro/

Let regex more readable - http://martinfowler.com/bliki/ComposedRegex.html

Useful Regular regression

Match username - /^[a-zA-Z0-9_]{3,16}$/
Matching an XHTML/XML tag - {]*>(.*?)}
Matching an XHTML/XML tag with a certain attribute value (e.g. class or tag) - {]*attribute\\s*=\\s*(["'])value\\\\1[^>]*>(.*?)}
Matching a URL - (a very long one... refer to article...)

http://immike.net[..]ssions-every-web-programmer-should-know/

The danger of bad regex - http://andreas.haufler.info[..]o-kill-java-with-regular-expression.html http://www.regular-expressions.info/catastrophic.html http://vladmihalcea.com/2014/02/24/the-regex-that-broke-a-server/

You have a string “BEFOREAFTER”. If this string has a ‘x’ in it, you want to capture everything before the ‘x’, else you want to capture the whole string. So,
”BEFOREAFTER” gives “BEFOREAFTER”
”BEFORExAFTER” gives “BEFORE”
http://octodecillion.com[..]apture-with-optional-delimeter/#solution

http://www.infoq.com[..]/regular-expressions-introduction-part01


(google search) (amazon search)
second
download zip of files only