Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. 12:26 < proprietarysucks> I want to get the second part of this: name "something" -> I want the 'something'. I tried this, but the line starts with whitespace, so
  2. this matches other wrong lines too: match = re.search('(?<=name ")[^"]+', line)
  3. 12:27 < proprietarysucks> so then I changed it to match = re.search('(?<=^\s+name ")[^"]+', line) which just complains and dies
  4. 12:28 < proprietarysucks> then I changed to just match = re.search('^\s+name', line) for a test, but this is just returning 'name'
  5. 12:28 < proprietarysucks> name "something i care about"
  6. 12:29 < proprietarysucks> awesome name "blah" line that I don't care about
  7. 12:29 < proprietarysucks> what am I missing here on how to get 'something i care about' from the top line and not match the second
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement