django 1 Posted June 24, 2013 Report Share Posted June 24, 2013 I am trying to learn regex but always fail with code here is what i wana achieve <outerhtml=r"<a href=\"/blogger.g?blogID=2222994297700933331#editor/src=dashboard\" class=\"GEE3RVNDAX\">Start blogging!</a>"> I just want blogID no 2222994297700933331 Quote Link to post Share on other sites
UBotDev 276 Posted June 24, 2013 Report Share Posted June 24, 2013 Here is the expression: (?<=blogID=)\d+(?=#) 1 Quote Link to post Share on other sites
django 1 Posted June 24, 2013 Author Report Share Posted June 24, 2013 ah thx really fast response now its time to learn regex :-) Quote Link to post Share on other sites
UBotDev 276 Posted June 24, 2013 Report Share Posted June 24, 2013 Np. Let me help you...first parenthesis describe that string should starts with "blogID=" and the last pair describes that it should end with "#". Between those pairs you specify what do you want regex to return, and in our case we want number, so we specify that with "\d+", which describes that result should contain at least one digit. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.