Relative Content

Tag Archive for pythonregexpython-re

How to grab number after word in python

I have a huge file containing the following lines DDD-1126N|refseq:NP_285726|uniprotkb:P00112 and DDD-1081N|uniprotkb:P12121, I want to grab the number after uniprotkb.

regex for text extraction in python

I’m trying to extract whatever is between ‘[…]’ and ‘- Aufgabe …’ in the below strings. Either or both of ‘[…]’ and ‘- Aufgabe …’ are optional and may not sometimes exist.

Extract only words using regex

I want to extract only words. The word should not contain any number or any special character attached to it, e.g. (64-bit), WebView2, x86_64. Current regex is able to ignore WebView2 and x86_64 but in the case of (64-bit) it’s returning me bit, which I don’t want. I want to exclude it because it contains numbers with -,(,) characters.

Regex not working as expected on a string

I have a string file in python that contains a number of segments “SCHOOL n:” that I would like to split the string on, where n can be any number 1-9. I am using this code snippet:

How to retrieve last dollar amount from a line

I am trying to get a code in Python that can look through a string like this one "986.80 CCF X $5.89 $5812.25" and return only the floating point number after the second “$” character. In this case it should return 5812.25