Tagged Questions
0
votes
1answer
60 views
Improvment of and looping in a regular expression pattern
My implemented regex pattern contains two repeating symbols: \d{2}\. and <p>(.*)</p>. I want to get rid of this repetition and asked myself if there is a way to loop in Python's regular ...
0
votes
0answers
48 views
Python pattern searching using re standard lib, str.find()
I'm trying to improve some code in order to get a better perfomance, I have to do a lot of pattern matching for little tags on medium large strings, for example:
import re
STR = ...
1
vote
2answers
61 views
Http url validating
What do you think about this?
#utils.py
def is_http_url(s):
"""
Returns true if s is valid http url, else false
Arguments:
- `s`:
"""
if ...
3
votes
2answers
168 views
Python function to match filenames with extension names
I have written a Python function which matches all files in the current directory with a list of extension names. It is working correctly.
import os, sys, time, re, stat
def matchextname(extnames, ...
0
votes
3answers
95 views
Minimize Number of Lists
I have a string, where I am only interested in getting the numbers encapsulated in single quotes.
For instance if I have the string "hsa456456 ['1', '2', ...]
I only want the 1 and the 2 and ...
2
votes
2answers
100 views
Want to sharpen my Python / Regex skills
I have a relatively simple project to parse some http server logs using Python and SQLite. I wrote up the code but I'm always looking for tips on being a better Python scripter. Though this is a ...
3
votes
1answer
140 views
Implementation of Python's re.split in Clojure (with capturing parentheses)
If you use capturing parenthesis in the regular expression pattern in Python's re.split() function, it will include the matching groups in the result (Python's documentation).
I need this in my ...
2
votes
2answers
195 views
Replace match inside tags
The problem I want to solve is to replace a given string inside tags.
For example, if I'm given:
Some text abc [tag]some text abc, more text abc[/tag] still some more text
I want to replace abc ...
0
votes
1answer
560 views
Python program for converting scientific notation to fixed point
I had to replace all instances of scientific notation with fixed point, and wrote a Python script to help out. Here it is:
#!/usr/bin/python2
# Originally written by Anton Golov on 29 Jan 2012.
# ...
3
votes
1answer
80 views
Please help me review some regexes for google app engine
My app is growing from small to medium and I'm adding functions that should get reviewed.
My routing is
routes = [
(r'/', CyberFazeHandler),
(r'/vi/(eyes|mouth|nose)', ...
2
votes
2answers
203 views
Brace pairing ({}[]()<>) cleanup/speedup
This is working as expected, except in the speed area + I need to make it more readable and shorter if possible, I probably have lot's of things I don't need :).
Edit it is working now
charset = ...
2
votes
1answer
896 views
Converting JSONP to JSON: Is this Regex correct?
I'm fetching a string that is JSONP, and looking to convert it to JSON.
I'm using the following regular expression for matching (for removal) the padding on the JSON.
([a-zA-Z_0-9\.]*\()|(\);?$)
...