Sunday, 15 August 2010

java - Regular expression help for href attribute check -



java - Regular expression help for href attribute check -

i have below regular look check href attribute checks protocol, sitename & domain. need add together check "javascript:". help me on this? not able work.

(\s)*((ht|)f)tp(s?)://|mailto:)[\p{l}\p{n}\.\#@\$%\+&;:\-_~,\?=/!\(\)]*(\s)*

from first set of matching parenthesis, add together "or" possibility after mailto. alter from:

(\s)*((ht|f)tp(s?)://|mailto:)[\p{l}\p{n}\.\#@\$%\+&;:\-_~,\?=/!\(\)]*(\s)*

to

(\s)*((ht|f)tp(s?)://|mailto:|javascript:)[\p{l}\p{n}\.\#@\$%\+&;:\-_~,\?=/!\(\)]*(\s)*

not sure if regex got messed while posting here, parenthesis around http/ftp part bit messed up

java html regex

No comments:

Post a Comment