Monday, July 30, 2012

regex – javascript regexp, can't get + expression to work



I am trying to pull the number from a string per the CSS format as follows:



str == \"50.1px\"

sz = str.match(/+([0-9]|\\.)/)


It complains about the + expression unless I escape it, but then then sz is null. If I remove the + it returns only the first digit. I\’m completely stumped.






Rating: 2 out of 5 based on 3 ratings



The post regex – javascript regexp, can't get + expression to work appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/regex-javascript-regexp-cant-get-expression-to-work.html

No comments:

Post a Comment