-4
votes
0answers
51 views

regex invalid syntax line c

Hey, i'm searching how verify syntax line in python with a regex. These lines are invalid and need to return 1 i= 0; i =0; while (i<5) while (i <5) while (i< 5) strcat(buffer,ez) ...
0
votes
1answer
24 views

Regex to match sentences from facebook posts and comments

Looking to get a regex working in python that captures all of the message within a facebook post but then STOPS (instead of returning the rest of the JSON textline). I know the specific field that ...
0
votes
2answers
28 views

how to add wildcards to the re.sub and remove all characters before the _

i have the following code infile = botslib.opendata(ta_from.filename,'r') tofile = botslib.opendata(str(ta_to.idta),'wb') start = infile.readline() import textwrap import re ...
0
votes
1answer
50 views

Regular expression for UK Mobile Number - Python

I need a regular expression that only validates UK mobile numbers. A UK mobile number can be between 10-14 digits and either starts with 07, or omits the 0 and starts with 447. Importantly, if the ...
0
votes
1answer
39 views

Regular expression passes number in the first byte

I am trying to check to make sure a variable name starts only with alphabet and trying the below code to do it, But for some reason it's failing >>> a='1' >>> if ...
0
votes
2answers
62 views

Editing lines and removing lines from file

I have a file of accession numbers and 16S rrna sequences, and what I'm trying to do is remove all lines of RNA, and only keep the lines with the accession numbers and the species name (and remove all ...
2
votes
2answers
37 views

replacing last part of string after pattern

What is the best way to remove the last bit of a string, following a certain recognized pattern? For example: s = 'some Strings-and-stuff - SomeOther Strings-and-stuff - TAke.THis last -part ...
6
votes
3answers
142 views

How to eliminate the ☎ unicode?

During web scraping and after getting rid of all html tags, I got the black telephone character \u260e in unicode (☎). But unlike this response I do want to get rid of it too. I used the following ...
2
votes
1answer
74 views

Regular expression to split a huge string into multiple sets of key-value pairs

I've a huge string which contains many sets, each is separated by ,. Each set has key-value pairs in it, each pair is separated by &. Here is small example, ...
2
votes
1answer
50 views

repetition “{}” on fly for regex

I am trying to write a function that compare a value with a regex to see if matches. The problem is that I have quite a many regex that are similar with just one difference which the range {} e.g. ...
1
vote
2answers
61 views

Find numbers in string, modify and re-join

Probem: I have a string containing different numbers, math signs and words, e.g. str = ".1**2 + x/(10.0 - 2.E-4)*n_elts" I would like to extract all numbers and keep the parts between the numbers ...
0
votes
2answers
34 views

extracting a double from the middle of a string, can't use replace

I am trying to test a cache, and I need to extract information from the output. My code is as follows: import re for line in open("test-fmath.simout_ruu_size_2"): if "avg_alu_power " in line: ...
1
vote
2answers
39 views

How to find first instance of HTML comment starting with <!— ? (Python)

Is there a simple way of finding the first instance of HTML comment starting with <!--? I've been doing it as such: for line in open('some.html'): if line[:4] == "<!--": print line ...
4
votes
2answers
62 views

How does Python Re Module work in this examle?

What is the process of matching this regular expression? I don't get why the explicit group is 'c'. This is piece of code is taken from Python Re Module Doc. >>> m = re.match("([abc])+", ...
-4
votes
0answers
64 views

Return 1st string that comes after the 1st “ahpt?” [closed]

This has been driving crazy! I'm trying to use regex (python) to return this string ...

1 2 3 4 5 296
15 30 50 per page