ruby on rails - Regex - Capturing a number if a match exists -


I'm looking to capture the number after the vspace . How would you do it regex? Here is a sample string.

  & lt; Img align = "left" alt = "dude its me" border = "10" height = "168" hspace = "30" vspace = "10" width = "130" />  

then the end result will be 10

< Previous> & gt; & Gt; S = '& lt; Img align = "left" alt = "dude its me" border = "10" height = "168" hspace = "30" vspace = "10" width = "130" /> & Gt; & Gt; /vspace="(\d+)"/.match(s)[1] = & gt; Or, if you are not sure whether this exists or not:
  if / vspace = "(\ d +)" / = ~ S puts $ 1 and puts "no match" end  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -