Category : regexp-replace

I am not sure how to specify a greedy regex.replace in pandas str.replace(). Note the following example: import pandas as pd pattern = "banana|bananas" replacement = "replace" series = pd.Series(["bananas/minute"]) if I run series.str.replace(pattern, replacement, regex=True) the result is replaces/minute (instead of replace/minute, as I’d want it to be), because assume that the regex evaluation ..

Read more

Sample data: /SomeText/2016-11-11 /SomeText/2016-11-11/13.40.48 /SomeText/15.T-06-26/00.00.00 I tried to compile a list of regex patterns but it was not working. I am not well skilled with regex patterns. What I am trying to do is make a list of regex patterns that matches anything after: /SomeText/ and remove it from the column and store the new ..

Read more

I’m new at regex and I have to extract some data that are in-between: [[(.*?)]], however not those that have after. movie = ”[[**Iron Man (film)|Iron Man**]]”<br>”[[The Incredible Hulk]]” <small>([[List of Post-credits Scenes|pre-credits scene]])</small><br>”[[**Iron Man 2**]]”<br>”[[Thor (film)|Thor]]” <small>(mentioned)</small><br>”[[**The Avenger**s]]”<br>”[[**Iron Man 3**]]”<br>’ I only want the text marked as fat. Right now im using this pattern: ..

Read more