We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The re module for pyjs does not handle backreferences in replacement text.
For example, regexes to do simple reformatting of text, as in:
Text between single asterisks will be emphasized. Text between double asterisks will be bolded.
Can be handled by these compiled regular expressions:
B_re = re.compile(r'\*\*(.*?)\*\*', re.DOTALL) EM_re = re.compile(r'\*(.*?)\*', re.DOTALL)
and later used like this:
txt = myTextArea.getText() txt = B_re.sub(r'<STRONG>\1</STRONG>', txt) txt = EM_re.sub(r'<EM>\1</EM>', txt)
This works great with pyjd, but with pyjs, you get "\1" in the replacement text, not the backreference.
Full example is attached.
Original issue: http://code.google.com/p/pyjamas/issues/detail?id=495 (September 18, 2010 16:02:23)
The text was updated successfully, but these errors were encountered:
Blast - just encountered this myself.
Sorry, something went wrong.
my workaround is along these lines:
otext = "text with a http://chozabu.org link" newtext=""+otext exp= r"((https?|ftp)://[^ ]+)" linklist=re.findall(exp, otext) for link in linklist: newlink = "<a href="+link[0]+">"+link[0]+"</a>" newtext = newtext.replace(link[0], newlink) self.add(HTML(newtext))
No branches or pull requests
The re module for pyjs does not handle backreferences in replacement
text.
For example, regexes to do simple reformatting of text, as in:
Text between single asterisks will be emphasized.
Text between double asterisks will be bolded.
Can be handled by these compiled regular expressions:
and later used like this:
This works great with pyjd, but with pyjs, you get "\1" in the
replacement text, not the backreference.
Full example is attached.
Original issue: http://code.google.com/p/pyjamas/issues/detail?id=495 (September 18, 2010 16:02:23)
The text was updated successfully, but these errors were encountered: