Regular Expressions – Get Value

#################################
# data string as following :
#################################

TITLE=title name
CLICK=click Login button to continue.
TYPE=type your login password and.
RETYPE=retype your login password.
PASSWD=Password
BUTTON=Login

#################################

//regex = /LOGIN_CLICK=([\w .,]+)/;
regex = tagname + “=([\\w .,]+)”;
re = new RegExp(regex);
result = datastring.match(re)[1];


regex = /CLICK =([\w .,]+)/;
the value of datastring.match(re)[1] is “click Login button to continue.”

regex = /PASSWD =([\w .,]+)/;
the value is “Password”

#################################
# process unicode
#################################
/PASSWD=([\w .,’\u00A1-\uFFFF]+)/ –> process utf-8
/PASSWD=([\w .,’\x00A1-\xFFFF]+)/ –> safari process utf-8

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.