[Solved] Newbie need Help python regex [closed]


There are many different approaches to designing a suitable regular expression which depend on the range of possible inputs you are likely to encounter.

The following would solve your exact question but could fail given different styled input. You need to provide more details, but this would be a start.

re_content = re.search("aid\: \"([0-9]*?)\",\W*cmt_id = ([0-9]*?);", input)

print re_content.groups()

This gives the following output:

('1168577519', '1168594403')

This example assumes that there might be other numbers in your input, and you are trying to extract just the aid and cmt_id values.

1

solved Newbie need Help python regex [closed]