All Questions
37 questions
0
votes
1
answer
235
views
Python parsing update statements using regex
I'm trying to find a regex expression in python that will be able to handle most of the UPDATE queries that I throw at if from my DB. I can't use sqlparse or any other libraries that may be useful ...
1
vote
2
answers
180
views
How can I split this string (log line) by multiple different characters/patterns?
I have a string like this:
66.249.69.97 - - [24/Sep/2014:22:25:44 +0000] "GET /071300/242153 HTTP/1.1" 404 514 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
I'm ...
2
votes
1
answer
36
views
Need help to write right parsing option
I need to parse text file which looks like this:
key : 123
anotherKey : qwer
oneMoreKey :
somestring,
somestring
There are a lot of this ...
-1
votes
1
answer
32
views
How do I get C function calls which has underscore in it using Regular expression in Python?
I am writing a Python script for parsing C function calls in a function definition. The function name may have one or more underscore in it. Below is the sample code:-
import re
line = "int main(){\...
2
votes
5
answers
234
views
Parsing text files with "magic" values
Background
I have some large text files used in an automation script for audio tuning. Each line in the text file looks roughly like:
A[BANANA] + B[PINEAPPLE] - C[CHERRY] [[BANANA]] BANANA # BANANA
...
-2
votes
1
answer
900
views
Splitting a string similar to ip addresses using regex in Python
I want to have a regular expression which will split on seeing a '.'(dot)
For example:
Input: '1.2.3.4.5.6'
Output : ['1', '2', '3', '4', '5', '6']
What I have tried:-
>>> pattern = '(\d+)(...
4
votes
2
answers
20k
views
Python - Parsing and converting string into timestamp [closed]
I have string in next format: 2017-02-14T09:51:46.000-0600
What is the best approach to parse and convert string into timestamp?
I have options to use regular expression or to write my own ...
0
votes
0
answers
567
views
Python: how to get the first line of several lines that match against a regular expression?
I'm trying to parse an UniProt flat file using regular expressions. Specifically, I want to parse the first line of the series of line containing the features.
Some of the files look like this:
ID ...
2
votes
1
answer
167
views
Split line on comma but not comma within quotes?
I have an input file whose head looks like this:
AdditionalCookout.create!([
{day_id: 275, cookout_id: 71, description: "Sample text, that, is ,driving , me, crazy"},
{day_id: 275, cookout_id: 87,...
0
votes
1
answer
396
views
Regex to include and exclude certain IPs
I have a functional python 2.7 code that extracts IPs from the routing table. It only extracts ip in x.x.x.x/xx format. I do however has a issue excluding some lines in the route table.
For example,...
0
votes
0
answers
65
views
python - A better and shorter way to parse it?
Is there a better way to structure the following three BLOCKS. My way seems to be very inneficient and it won't be easy to add more data extraction in the future. Perhaps using the re.compile sintaxis ...
0
votes
1
answer
231
views
How to parse email body without previous conversation ?
In gmail when we conversation with others then at the end each email concatenate with previous conversation. by the help of python imaplib library i get the email body like below . Now i want to ...
0
votes
1
answer
506
views
How to keep repetative punctuation while parsing python string?
I need to process small amounts of texts (i.e. strings in python).
I want to remove certain punctuation
(like '.', ',', ':', ';', )
but keep punctuation indicative of emotions like ('...', '?', '??...
0
votes
2
answers
857
views
How to convert a list of slash separated strings into a nested dictionary?
I have a list of data in the following format:
viewsList = [
"/list/devicetype",
"/list/client/devicetype",
"/list/client/site/devicetype",
"/list/privileges",
"/list/client/serviceusage",
...
2
votes
2
answers
101
views
Splitting string with delimiter one and index[0] with other
How do I split this multple delimiter without creating two list and appending which seems to be very performance suffering opernation.
string = 'ABCD.EFGH.IJKLM|NOPQ|RSTUV'
string.split("|")[0]....