Reputation: 35
I am trying to extract a substring from the below mentioned html tag,but i cannot extract the substring.
<input type="checkbox" name="checked" tabindex="true" value="28744628*Postpaid" onclick="disSelectCheckBox();">
from the above tags i want to extract the substring 28744628,and for this i am trying the following regular expressions:
1)<input type="checkbox" name="checked" tabindex="true" value="(.+?)*Postpaid" onclick="disSelectCheckBox();"
--> if i use this expression no value is being retreived.
2)<input type="checkbox" name="checked" tabindex="true" value="(.+?)" onclick="disSelectCheckBox();"
--> if i use this expression the whole string(28744628*Postpaid) is extracted,where as i want only the substring(28744628).
Can you provide any inputs??
Upvotes: 1
Views: 107
Reputation: 67978
value="(.+?)\*Postpaid
^
Escape your *
.It is a quantifier.It means 0 or more times
.(.+?)*
in effect gives no ouput as +?*
forms catastrophic backtracking.And your regex might be unable to complete.
See demo.
http://regex101.com/r/dZ1vT6/22
Upvotes: 1