Category : regex

So with following im adding Script from a webpage to a dict and afterwards trying to find a certain string in it, then get the 13 letters after: for link in productlinks: try: s = HTMLSession() r = s.get(link) response = urllib3.PoolManager().request( "GET", link, headers={‘User-Agent’: "python"}) soup = BeautifulSoup(response.data.decode(‘utf-8’), ‘html.parser’) title = r.html.find(‘h1.rd-title’, first=True).text script2 ..

Read more

I would like to know what is the regular expression of an SSID in python. Here is the regular expression in Js, but unfortunately I cannot convert it to python : ^[^!#;+]/"t][^+]/"t]{0,30}[^ !#;+]/"t]$|^[^ !#;+]/"t]$ Here are the naming conventions for an SSID : SSID Naming Conventions The default SSID for VAP0 is “ciscosb”. For all ..

Read more

I am trying to convert these 3 python regex expressions into java: Python segments=re.split(‘(([A-Za-z0-9]*)[0-9]*)’,compound) segment=re.split(‘)([0-9]*)’,segment) elementsAndNumbers=re.split(‘([A-Z][a-z]?)’,segment) Java List<String> segments = Arrays.asList(compound.split("(([A-Za-z0-9]*)[0-9]*)")); List<String> segment = Arrays.asList(segments.get(i).split(")([0-9]*)")); List<String> elementsAndNumbers = Arrays.asList(segment.split("([A-Z][a-z]?)")); Am I doing it right? Update When I directly copy the regex expression (for example 1.), I faced this error: error Error: "Illegal escape character in ..

Read more

I have a dataframe that contains values like: |column a| ——— |3.5M+ | |100,000 | |214,123 | |1.25M+ | I want to convert values like 3.5M+ to 3,500,000 I’ve tried: regex1 = r’.+M+’ for i in df.a: b = re.match(regex1, i) if b is not None: i = int(np.double(b.string.removesuffix(‘M+’))*1000000) else: i = i.replace(‘,’,”) if I ..

Read more

A regex noob here! I have these kind of strings: WILLIAM SMITH 2345 GLENDALE DR RM 245 ATLANTA GA 30328-3474 LINDSAY SCARPITTA 655 W GRACE ST APT 418 CHICAGO IL 60613-4046 I want to make sure that strings I will get are like those strings like above. Here’s my regular expression: [A-Z]+ [A-Z]+ [0-9]{3,4} [A-Z]+ ..

Read more