Extract keywords from links

I’m trying to extract the first 2 numbers in links like these: https://primer.text.com/sdfg/8406758680-345386743-DSS1-S%20Jasd%12Odsfr%12Iwetds-Osdgf/ https://primer.text.com/sdfg/8945879094-849328844-DPE-S%20Jsdfe%12OIert-Isdfu/ https://primer.text.com/sdfg/8493093053-292494834-QW23%23Wsdfg%23Iprf%64Uiojn%32Asdfg-Werts/ The output should be like this: id1 = [‘8406758680’, ‘8945879094’,’8493093053′] id2 = [‘345386743’, ‘849328844’, ‘292494834’] I’m trying to do this using the re module. Please, tell me how to do it. This the code snippet I have so far: def… Read More Extract keywords from links

how to return matched keywords in the pandas str.contains using regex parameter?

This is my sample code: import pandas as pd df = pd.DataFrame({‘A’: [‘btcrr’, ‘You have crypto here’, ‘coinbase.com was there ‘, ‘hotwalletint’] }) regex = r"(^|\W)(?:btc|crypto|coinbase|hotwallet)[^A-Za-z0-9]" tagged_df = df[df[‘A’].str.contains(regex, na=False, regex=True, case=False)] The output of tagged_df: A 1 You have crypto here 2 coinbase.com was there In this case, this will return only if it… Read More how to return matched keywords in the pandas str.contains using regex parameter?