importing re in Jython

  • Thread starter Alexis Francart
  • Start date
A

Alexis Francart

Hello,

I want to use a program called maxq. This program is used for functionnal
and regression test of web application. The language it uses is Jython.
I need to get a part of a web page using regular expression.
However i try to import the RE library but i'm not able to.
Since the Jython.jar already contains an ORO i tried to use it but without
success. I then tried to import the RE library but was unable to do so. I
then try to import the regexp library from jakarta but without success.

Do you know how i can import the RE module in Jython?

NB: I hope the part on my life interested you since it has not too much to
do with the question.

Alexis
 
A

Alexis Francart

Do you know how i can import the RE module in Jython?

Ok i've managed to import it. I'm new to jython and python so i think this
is basic but unless the command line you have got to enter the whole pass
in the script so ihave to enter

from org.python.modules import re

instead of a simple

import re

thanks for your help
 
A

Alan Kennedy

Alexis said:
Do you know how i can import the RE module in Jython?

Works fine for me on Win2K, J2SDK1.4.2 and Jython 2.1:-

Jython 2.1 on java1.4.2 (JIT: null)
Type "copyright", "credits" or "license" for more information.
import re
rx = re.compile('[0-9]+')
for sn in ['1', '10', 's10']:
.... m = rx.match(sn)
.... if m:
.... print "'%s' matches" % sn
....
'1' matches
'10' matches
Perhaps if you gave us some details, such as

1. Your OS
2. Your JRE version
3. Your jython version
4. What code you're using

Then it might be easier to help out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top