importing re in Jython

Discussion in 'Python' started by Alexis Francart, Jul 9, 2003.

  1. 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
    Alexis Francart, Jul 9, 2003
    #1
    1. Advertising

  2. Alexis Francart <> wrote in
    news:Xns93B386C32C053alexisfrancartnospam@193.252.19.141:

    > 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
    Alexis Francart, Jul 9, 2003
    #2
    1. Advertising

  3. Alexis Francart

    Alan Kennedy Guest

    Alexis Francart wrote:

    > 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.

    --
    alan kennedy
    -----------------------------------------------------
    check http headers here: http://xhaus.com/headers
    email alan: http://xhaus.com/mailto/alan
    Alan Kennedy, Jul 9, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David McNab
    Replies:
    0
    Views:
    484
    David McNab
    Apr 9, 2004
  2. Replies:
    2
    Views:
    364
  3. Divya Prakash
    Replies:
    0
    Views:
    428
    Divya Prakash
    Dec 19, 2006
  4. Pinegar, Kent T

    FW: [Jython-users] Jython Licensing Question

    Pinegar, Kent T, Jul 24, 2008, in forum: Python
    Replies:
    0
    Views:
    346
    Pinegar, Kent T
    Jul 24, 2008
  5. Gubatron
    Replies:
    2
    Views:
    565
    Gubatron
    Dec 3, 2008
Loading...

Share This Page