importing re in Jython

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexis Francart

    importing re in Jython

    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

    #2
    Re: importing re in Jython

    Alexis Francart <alexis.francar t@nospam.xagagr oup.com> wrote in
    news:Xns93B386C 32C053alexisfra ncartnospam@193 .252.19.141:
    [color=blue]
    > Do you know how i can import the RE module in Jython?[/color]

    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.modu les import re

    instead of a simple

    import re

    thanks for your help

    Comment

    • Alan Kennedy

      #3
      Re: importing re in Jython

      Alexis Francart wrote:
      [color=blue]
      > Do you know how i can import the RE module in Jython?[/color]

      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.[color=blue][color=green][color=darkred]
      >>> import re
      >>> rx = re.compile('[0-9]+')
      >>> for sn in ['1', '10', 's10']:[/color][/color][/color]
      .... m = rx.match(sn)
      .... if m:
      .... print "'%s' matches" % sn
      ....
      '1' matches
      '10' matches[color=blue][color=green][color=darkred]
      >>>[/color][/color][/color]

      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

      Comment

      Working...