Tagged Questions
3
votes
0answers
227 views
How to create custom function in a QSqlDatabase: regex in sqlite and pyqt
We define the python type REGEXP function in sqlite and python following Problem with regexp python and sqlite
How can we do the same thing in PyQT, ie. with a QSqlDatabase?
More precisely, we use ...
2
votes
0answers
473 views
python regex sub space
CODE:
word = 'aiuhsdjfööäö ; sdfdfd'
word1=re.sub('[^^äÄöÖåÅA-Za-z0-9\t\r\n\f()!{$}.+?|]',"""\[^^0-9\t\r\n\f(!){$}.+?|\]*""", word) ; print 'word= ', word
...
1
vote
0answers
68 views
OR'ed backreferences in regular expressions
Could someone please explain how this regular expression is supposed to work:
^(a)|\1$
?
I intepret it as:
*1. start of string,
followed by:
*2. either:
*2a. an a,
or:
*2b. the previously ...
0
votes
0answers
51 views
replacing wiki markups with HTML tags using regular expressions in Python
I have been given several text documents that are formatted with wiki markups (==, ===, --, --, # etc), and i have to reformat them with HTML tags (–, —,<> etc) instead. now it has to ...
0
votes
0answers
88 views
PDF to HTML conversion / Regex replace and concat matches in Python
I have written a pdf to Excel converter.
The conversion is done by linux command pdftohtml but sometimes it looks strange like these:
<b>1 </b><br>
In<br>
I t<br>
n ...
0
votes
0answers
68 views
Separate incoming data with regex
I have data that's coming one character at a time. For example:
out = {
than after some time:
out = {"created_at":"Fri Apr 19 19:43:25 +0000 2013","id":325333836244"
So what I want to do is to ...
0
votes
0answers
42 views
how to search pattern after my last input, pexpect in case of interaction scenario
i am using pexpect(a python module) in my automation testing. But pexpect sometime doesn't work as what I expect, my case is that:
telnet to a host
execute command1, and wait for a pattern ...
0
votes
0answers
42 views
Retrieve groups not filled by match.expand in Python
I'm building some sort of a CMS for Python from ground-up(yes, I know there are a ton, I just want to make my own, partly because I want to improve my Python skills). My problem is when routing ...
0
votes
0answers
48 views
uncode string not working with urlparse inspite of conversion to utf8
Im trying to find a substring 'foro.enfemenino.com' in the url
str2 = 'http://foro.enfemenino.com/forum/f166/__f22092_f166-Servicio-tecnico-philips-en-castelldefells-tel-900-100-137.html#25144'
...
0
votes
0answers
81 views
Split string into regex matches
Having multiple regexps that match certain part of a string (e.g. (?P<g1>a+) and (?P<g2>b+)), how to split string (e.g. aabcdcb) into such pieces: [{'g1': 'aa'}, {'g2': 'b'}, {'other': ...
0
votes
0answers
246 views
'NoneType' object has no attribute 'match'
i am using the re library to validate phone numbers by regular expression and i have used the same exact code before on other project and it was working well, but now i get
'NoneType' object has no ...
0
votes
0answers
79 views
Replacing Text Using Regular Expression in Python With Named Parameters
I have the string "(r'^users/', include('users.urls')),". I want user to be able to change it to say "(r'^users_part_has_been_changed_by_user/', include('users.urls')),"
The regular expression is ...
0
votes
0answers
112 views
svnperms.py access configuration error
I am trying to block write access to a specific directory in trunk "trunk/Development/Code/Project.ContentDelivery" for all users except admins. Here's the svnperms.conf file
[fprepo_locked groups]
...
0
votes
0answers
118 views
Variable word matching in python
I am unable to build a regular expression in python which can find a unicode word (a complete word) in a unicode text. I have tried these statements:
expr = re.compile(r'\b'+word+r'\b')
matches = ...
0
votes
0answers
66 views
python re halt while running the code inside import statement
Strange problem, can any I explain to me why?
exactly the same code (regular expression code) inside a python function.
In interactive console mode:
If I run that code from a function call after ...