Off Topic: Books about Regular Expression

Hi
Somebody can to indicate books about Regular Expression in Oracle ?
Thanks

Regex tag of Blog of Volder.
http://volder-notes.blogspot.com/search/label/Regular%20Expressions
This entry mentions my regex solution :-)
http://volder-notes.blogspot.com/2007/10/removing-duplicate-elements-from-string.html
By the way
My regex homepage mentions regex problems of perl like regex (regex of EmEditor).
http://www.geocities.jp/oraclesqlpuzzle/regex/
example questions (written by Japanese language)
http://www.geocities.jp/oraclesqlpuzzle/regex/regex-2-1.html
http://www.geocities.jp/oraclesqlpuzzle/regex/regex-3-5.html
http://www.geocities.jp/oraclesqlpuzzle/regex/regex-4-4.html

Similar Messages

  • Strange result about regular expressions

    Hello everybody,
    I write these codes to try regular expressions in Java, but there are some strang results. I read the reference like Sun Java Tutorials. however, I cann't find the problem.
    Environnement:
    WindowsXP Home + NetBeans IDE 5.0 + JDK 1.5
    Input String:
    "I write these codes to try regular expressions in Java, but it doesn't work. I read some reference like Sun Java Tutorials. Then, always cann't find the problem. Could you help me? Thanks."
    My codes:
    public static void main(String[] args) throws Exception, IOException {
    P.rintln("Let's go!");
    Date start = new Date();
    if(args.length != 1) {
    P.rintln("Input Error! Input format: java javaclass [directory path]");
    System.exit(0);
    StringBuffer sb = new StringBuffer();
    String input = TextFile.read(args[0]);
    sb = addSectionEelement(input, "re");
    P.rintln(sb.toString());
    P.rintln("Ok, it's over");
    Date end = new Date();
    System.out.println("It spends " + (end.getTime() - start.getTime()) + " ms.");
    public static StringBuffer addSectionEelement(String input, String regex) {
    Matcher m = Pattern.compile(regex).matcher(input);
    StringBuffer sb = new StringBuffer();
    int count = 0;
    while(m.find()) {
    count++;
    P.rintln(m.group());
    P.rintln("Found " + count + " fois.");
    return sb;
    Output:
    run:
    Let's go!
    Found 0 fois.
    Ok, it's over
    It spends 16 ms.
    BUILD SUCCESSFUL (total time: 0 seconds)
    However if I change the Bold line by
    sb = addSectionEelement(input, "r");
    The resultats become:
    run:
    Let's go!
    r
    r
    r
    r
    r
    r
    r
    r
    r
    r
    r
    Found 11 fois.
    Ok, it's over
    It spends 15 ms.
    BUILD SUCCESSFUL (total time: 0 seconds)
    I have no idea about it. And you?
    Thanks

    Hi guys,
    I re-examine the codes. In fact, it's the problem of encodings of the input file.
    See u

  • Help About Regular Expression.

    Hello,
    I am trying to parse string buffer by using Regular Expression.
    Suppose my string buffer is:
    Hi , How are you?
    Hello: abc
    hurrey : [ this is test msg
    Pls reply to this mail
    Hello: xyz
    Test1
    I want to search string: "Hello: anystring till end of line" which is
    not included in [].
    So In above example my Regular expression should only find
    first "Hello: abc".
    Is it possible by using Regular expression?

    Can we have Regular Expression which will get both "Hello: string"
    suppose my string buffer is:
    Hi , How are you?
    Hello: abc
    hurrey : [ this is test msg
    Pls reply to this mail
    Hello: xyz
    Test1
    happy: [ test2
    my test
    Hello: abc
    then result should be :
    Hello: abc
    [ this is test msg
    Pls reply to this mail
    Hello: xyz
    Test1
    [ test2
    my test
    Hello: abc
    ]

  • Question about Regular Expressions, please help!

    I have created an app which reads files and extracts certain data using regular expressions in JDK1.4 using Pattern and Matcher classes.
    However it needs to run on JDK1.2.2 (dont ask). The regular expression classes are not available in 1.2.2 (the Pattern and Matcher class) so i am looking for something similiar which i can use?
    I need something that loops through all the matches found in the file like how Matcher works i.e.
    while (matcher.find())
    // do this
    Help!

    http://jakarta.apache.org/regexp/

  • About regular expressions

    This question was posted in response to the following article: http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec0a38 f-7fff.html

    "ColdFusion supplies four functions that work with regular expressions" should be "ColdFusion supplies six functions that work with regular expressions,"

  • Basic question about regular expressions

    Hello,
    I am a beginner to regular expressions. I want to rewrite the following expression:
    public static final String REGULAR_EXP_SOFTWARE_PART_NUMBER = "([0-9]{7}[a-z]{1})(\\-{1})([a-z]{1})";I want THIS match
    (\\-{1})to occur EITHER if a hyphen is encountered OR if a space is encountered (instead of just the hyphen).
    How do I rewrite this?
    Thanks in advance,
    Julien.

    Hello and thanks for your feedback,
    I have created a small class as follows:
    package regExpr;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    * @author Martin
    public class RegExprTest {
         private static String stringToBeParsed = "3800157w-e26";
         public static void main(String[] args) {
              Pattern pattern = Pattern.compile("" +
                        "([0-9]{7})" +
                        "([a-z]{1})" +
                        "(( |-){1})" +
                        "([a-z]{1})" +
                        "([0-9]{2})" +
              Matcher matcher = pattern.matcher(stringToBeParsed);
              while(matcher.find()){
                   System.out.println(matcher.group(1));
                   System.out.println(matcher.group(2));
                   System.out.println(matcher.group(3));
                   System.out.println(matcher.group(4));
                   System.out.println(matcher.group(5));
                   System.out.println(matcher.group(6));
    }the class is trying tobreak down the following string "3800157w-e26" as follows:
    3800157(seven digits)
    w(one letter)
    -(hyphen)
    e(one letter)
    26(two digits)
    Oddly enough the output of the class is as follows:
    3800157
    w
    e
    26
    I have to call the group method six times and I get two hyphens!
    Can anyone help?
    Thanks in advance,
    Julien

  • Simple question about regular expressions

    Hi,
    Using Java's regular expression syntax, what is the correct pattern string to detect strings like the following :-
    AnnnnnA
    where A = a single (fixed) alphabetic character and
    n = at least one but possibly many digits [0-9].
    Example strings to be searched :-
    A45A (this should match)
    A3A (this should match)
    A3446655577A (this should match)
    A hello world A (this should NOT match as no digits are present between the A's).
    Thanks.

    A least one digit "A.*\\d.*A"
    Only digits "A\\d+A"

  • One question about Regular Expression!!!

    I need to creat such a regular expression to match the format "[ ][ ][ ]".
    For example, there is a context,
    (1), " The project manager defines [1][0.400][+goals] for iterations."
    Suppose that there are some spaces or "\n" characters in this way,
    (2), " The project manager defines [    1 ] [  0.400   ]
    [   +goals] for iterations."
    If the pattern match the format succefully, (2) strings should be replaced by (1)strings, in order words, the format of (1) is what I need finally,
    I had ever tried creating a regular expression likes \\[([^\n\s]]+)\\]\\[([^\n\s]]+)\\]\\[([^\n\s]]+)\\] , but it does not work well!
    DO YOU HOW TO IMPLEMENT IT IN JAVA?
    Thanks for your any reply!

    What I really need is that, via the regular
    expression, all the spaces and \n characters in
    square brackets [ and ], ] and [, will be thrown
    away.
    For example,
    Original:
    1) "The project manager defines [   1  ] [
    0.400 ]
    [   +goals] for iterations with the support"
    After matching:
    2) "The project manager defines [1][0.400][ [+goals]
    for iterations with the support"
    String 2) is what I need finally!
    Thanks for your any reply!Well I gave you the answer to that one already :-)
    If you need to preserve the spaces in between words use this one. I'm sure there's a better way to do it, I'm no RegEx master.
        public static void main(String[] args)
            String s = "[ 1 ] [ 0.400 ]\n[ +go als]";
            System.out.println( "Before: " + s );
            System.out.println( "\n\n" );
            s = s.replaceAll( "\\[\\s+", "[" );
            s = s.replaceAll( "\\s+\\]", "]" );
            s = s.replaceAll( "\\]\\s+\\[", "][" );
            System.out.println( "After: " + s );
        }

  • Beginner question about Regular expression

    Hi all !
    I'd like to use a regular expression to parse a string like this:
    *<ID>4</ID><GROUP>5</GROUP>....*
    So for example to retrieve the ID I have built the following regular expression:
    Pattern p = Pattern.compile("<ID>(.*?)</ID>");  
    Matcher m = p.matcher(handle);    
    if (m.find()) {
          System.out.println("->"+m.group());     
    } else {
    System.out.println("No match!");   
    }The function m.group returns "<ID>4</ID>" but I want just the value (4) between the tag. Is there
    a way to get it ?
    thanks a lot
    mark

    fmarchioniscreen wrote:
    thank you very much, that's exactly what I needed.
    But it looks like you're parsing some XML like data: probably better to use a proper parser on it. Well it's a very short string containing XML tags. it's used in a marginal area of the application so I prefer just using a regular expression to fetch the values
    thanks again
    MarkYou could use XPath to get the value.

  • Kinda off topic question about Naps

    Mod... feel free to close this if you feel you have to. I figured I might get a good response asking this here though.
    Anyway, I have a Zen Touch and a napster subscription. I liked the idea of being able to basically sample music (via the subscription) and then buy what I really like. Anyway, yesterday I bought my first album. It was an album that I had already downloaded via the subscription. I was under the impression that buying the album released any protection on it, and thus I would have a bunch of unprotected wma files. But after copying the wma files to another computer, I found this was not the case. I tried playing those files on the computer, and windows media player was still looking for my napster license. I was able to burn the tracks I purchased to a CD, like I'm supposed to be able to after purchasing them. But, is this what I have to do to "keep these tracks forever"? If my subscription runs out, will I not even be able to play the WMA files that I purchased? If that's the case, then this whole thing is disappointing. I was under the impression that by buying the tracks, they would no longer be tied to my napster subscription in any way, and I could create a library of wma tracks that I purchased, which I would be able to play and do whatever I want with after my subscription runs out. If I have to burn all my purchased tracks to CD to keep them forever, then what's the point of buying digital music? I still have to create a clutter of CDs if I want to keep the music. I realize of course that I could just rip the songs off the CDs I burn to have an unprotected file, but that's ridiculous.
    Does iTunes work like this? I.e., if I buy a track, it is still protected in any way?

    All DRM (WMA DRM or Apple Fairplay) stays with purchased tracks forever, UNLESS you burn an audio CD. On that audio CD there is no DRM anymore. You can rip it back into anything. Same thing in Napster, Yahoo, MSN Music, iTunes, etc..
    Here's how Napster works: You put Napster software (or WMP Napster plug-in) on as many computers as you want. No limit. Each track you buy gets a license to play on up to 3 computers. That's all. This license is for each track, not for Napster itself. You can have various tracks on many different computers so long as one track only plays on 3. When you go to, say, computer number two, you "synchronize" your Napster downloads. This puts all the stuff you downloaded or bought on that computer, too. Now you can play your purchased stuff on the second computer. Napster looks at the tracks you need on computer number two and automatically downloads a copy there when you synchronize. You do not need the full Napster software to do any of this--the WMP plug-in will work just as well. Tracks you download only (don't buy) will expire. The license will not allow them to play after you quit Napster. Tracks you buy from Napster have a license that does not expire. I have a whole bunch of these and I left Napster in September. They all play and all download to my Zen players, too. I just burned a few to CD recently, too.
    Message Edited by MikeM32 on -29-2005 0:5 AM

  • An additional question about regular expressions with String.matches

    does the String.matches() method match expressions when some substring of the String matches, or does it have to match the entire String? So, if i have the String "123ABC", and i ask to match "1 or more letters" will it fail because there are non-letters in the String, but then pass if i add "1 or more letters AND 1 or more digits"? so, in the latter every character in the String is accounted for in the search, as opposed to the first. Is that correct, or are there ways to JUST match some substring in the String instead of the whole thing? i WILL make some examples too... but does that make sense?

    It has to match the whole String. Use Matcher.find() to match on just a sub-string()

  • (off Topic) CountryList of regular of this forum

    WorldCup of Soccer is doing now.And Japan won twice :D
    I think this SQL-PL/SQL forum is WorldCup of SQL B-)
    Then let us listing CountryList of regular of this forum :-)
    if you want to be added anyone below List.please teach me ;-)
    create table CountryList(country,Name) as
    select 'Africa','Billy Verreynne' from dual union
    select 'Austria','cd_2' from dual union
    select 'Austria','Richard Foote' from dual union
    select 'Azerbaijan','Kamran Agayev A.' from dual union
    select 'Brazil','fsitja' from dual union
    select 'Canada','John Spencer' from dual union
    select 'Canada','Tubby' from dual union
    select 'Canada','Hans Forbrich' from dual union
    select 'Denmark','Peter Gjelstrup' from dual union
    select 'France','Nicolas Gasparotto' from dual union
    select 'Germany','michaels2' from dual union
    select 'Germany','Sven W.' from dual union
    select 'India','Karthick_Arp' from dual union
    select 'India','Satyaki_De' from dual union
    select 'India','Arunkumar Ramamoorthy' from dual union
    select 'India','ravikumar.sv' from dual union
    select 'India','009' from dual union
    select 'India','schavali' from dual union
    select 'India/US','Aman' from dual union
    select 'Italy','Massimo Ruocchio' from dual union
    select 'Japan','Aketi Jyuuzou' from dual union
    select 'NetherLands','hoek' from dual union
    select 'NetherLands','Alex Nuijten' from dual union
    select 'NetherLands','Rob van Wijk' from dual union
    select 'NetherLands','Toon Koppelaars' from dual union
    select 'NetherLands','Sybrand Bakker' from dual union
    select 'Russia','Volder' from dual union
    select 'Switzerland','Laurent Schneider' from dual union
    select 'UK','BluShadow' from dual union
    select 'UK','APC' from dual union
    select 'UK','Boneist' from dual union
    select 'UK','William Robertson' from dual union
    select 'UK','Jonathan Lewis' from dual union
    select 'Uruguay','Walter Fernandez' from dual union
    select 'USA','Frank Kulash' from dual union
    select 'USA','Centinul' from dual union
    select 'USA','Justin Cave' from dual union
    select 'USA','SanjayRs' from dual union
    select 'USA','Charles Hooper' from dual union
    select 'USA','Daniel Morgan' from dual;Edited by: Aketi Jyuuzou on Jun 27, 2010 4:45 PM (Add any people who are mentioned by below replys.)

    One thing I have requested of OTN leadership is that we be able to in our profiles have the ability to list, and search, for a bit of personal information.
    Charles Hooper (US)
    Daniel Morgan (US)
    Hans Forbrich (Canada)
    Jonathan Lewis (UK)
    Richard Foote (Australia)
    And if you want information on anyone that is an ACE or ACE Director you can find it here:
    http://apex.oracle.com/pls/otn/f?p=19297:3:2799519986939112
    and here
    http://maps.google.com/maps/ms?ie=UTF8&hl=en&oe=UTF8&msa=0&msid=101461418394975592073.000439f71111bb8cdc3b5

  • Simple question about regular expression

    Hi
    I have a little problem with
    select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
    answer: M
    I excecute this query in SQLPlus and SQL Developer result is this same.
    select regexp_substr('123 Mapla Avenue','[M]') my_test from dual;
    answer: M
    select regexp_substr('123 Mapla Avenue','[a]') my_test from dual;
    answer: a
    I used oracle 10g
    Thanks for your help

    hm wrote:
    In the oracle documentation of regexp_substr you can find:Do not confuse pattern and sort. Pattern [a-z] means any lowercase letter. REGEXP_SUBSTR parameter match_param value i tells REGEXP to treat uppercase letters same as lowercase letters and vice versa. And setting NLS_SORT can do the same. As you can see it is not that straight-forward. To make it transparent use exact pattern you need. In this particular case use:
    select regexp_substr('123 Mapla Avenue','[[:alpha:]]') my_test from dual;where class [:alpha:] is POSIX predefined class of all letters (regardless of case). This way you are not dependent of client side settings like NLS_SORT and the above will always return first letter within a string. If you want first uppercase letter use:
    select regexp_substr('123 Mapla Avenue','[[:upper:]]') my_test from dual;Or, for first lowercase letter:
    SQL> alter session set nls_sort=binary;
    Session altered.
    SQL> select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
    M
    a
    SQL> select regexp_substr('123 Mapla Avenue','[[:lower:]]') my_test from dual;
    M
    a
    SQL> alter session set nls_sort=binary_ci;
    Session altered.
    SQL> select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
    M
    M
    SQL> select regexp_substr('123 Mapla Avenue','[[:lower:]]') my_test from dual;
    M
    a
    SQL> SY.

  • Question about Regular Expressions

    Hi averyone!
    Could any one help me to create RegEx for string: <object>
    Thanks!
    Kind Regards, Dmitry.

    "<object>"

  • Re: [iPlanet-JATO] Re: Use Of models in utility classes - Pease don't forget about the regular expression potential

    Namburi,
    When you said you used the Reg Exp tool, did you use it only as
    preconfigured by the iMT migrate application wizard?
    Because the default configuration of the regular expression tool will only
    target the files in your ND project directories. If you wish to target
    classes outside of the normal directory scope, you have to either modify the
    "Source Directory" property OR create another instance of the regular
    expression tool. See the "Tool" menu in the iMT to create additional tool
    instances which can each be configured to target different sets of files
    using different sets of rules.
    Usually, I utilize 3 different sets of rules files on a given migration:
    spider2jato.xml
    these are the generic conversion rules (but includes the optimized rules for
    ViewBean and Model based code, i.e. these rules do not utilize the
    RequestManager since it is not needed for code running inside the ViewBean
    or Model classes)
    I run these rules against all files.
    See the file download section of this forum for periodic updates to these
    rules.
    nonProjectFileRules.xml
    these include rules that add the necessary
    RequestManager.getRequestContext(). etc prefixes to many of the common
    calls.
    I run these rules against user module and any other classes that do not are
    not ModuleServlet, ContainerView, or Model classes.
    appXRules.xml
    these rules include application specific changes that I discover while
    working on the project. A common thing here is changing import statements
    (since the migration tool moves ND project code into different jato
    packaging structure, you sometime need to adjust imports in non-project
    classes that previously imported ND project specific packages)
    So you see, you are not limited to one set of rules at all. Just be careful
    to keep track of your backups (the regexp tool provides several options in
    its Expert Properties related to back up strategies).
    ----- Original Message -----
    From: <vnamboori@y...>
    Sent: Wednesday, August 08, 2001 6:08 AM
    Subject: [iPlanet-JATO] Re: Use Of models in utility classes - Pease don't
    forget about the regular expression potential
    Thanks Matt, Mike, Todd
    This is a great input for our migration. Though we used the existing
    Regular Expression Mapping tool, we did not change this to meet our
    own needs as mentioned by Mike.
    We would certainly incorporate this to ease our migration.
    Namburi
    --- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
    All--
    Great response. By the way, the Regular Expression Tool uses thePerl5 RE
    syntax as implemented by Apache OROMatcher. If you're doing lotsof these
    sorts of migration changes manually, you should definitely buy theO'Reilly
    book "Mastering Regular Expressions" and generate some rules toautomate the
    conversion. Although they are definitely confusing at first,regular
    expressions are fairly easy to understand with some documentation,and are
    superbly effective at tackling this kind of migration task.
    Todd
    ----- Original Message -----
    From: "Mike Frisino" <Michael.Frisino@S...>
    Sent: Tuesday, August 07, 2001 5:20 PM
    Subject: Re: [iPlanet-JATO] Use Of models in utility classes -Pease don't
    forget about the regular expression potential
    Also, (and Matt's document may mention this)
    Please bear in mind that this statement is not totally correct:
    Since the migration tool does not do much of conversion for
    these
    utilities we have to do manually.Remember, the iMT is a SUITE of tools. There is the extractiontool, and
    the translation tool, and the regular expression tool, and severalother
    smaller tools (like the jar and compilation tools). It is correctto state
    that the extraction and translation tools only significantlyconvert the
    primary ND project objects (the pages, the data objects, and theproject
    classes). The extraction and translation tools do minimumtranslation of the
    User Module objects (i.e. they repackage the user module classes inthe new
    jato module packages). It is correct that for all other utilityclasses
    which are not formally part of the ND project, the extraction and
    translation tools do not perform any migration.
    However, the regular expression tool can "migrate" any arbitrary
    file
    (utility classes etc) to the degree that the regular expressionrules
    correlate to the code present in the arbitrary file. So first andforemost,
    if you have alot of spider code in your non-project classes youshould
    consider using the regular expression tool and if warranted adding
    additional rules to reduce the amount of manual adjustments thatneed to be
    made. I can stress this enough. We can even help you write theregular
    expression rules if you simply identify the code pattern you wish to
    convert. Just because there is not already a regular expressionrule to
    match your need does not mean it can't be written. We have notnearly
    exhausted the possibilities.
    For example if you say, we need to convert
    CSpider.getDataObject("X");
    To
    RequestManager.getRequestContext().getModelManager().getModel(XModel.class);
    Maybe we or somebody else in the list can help write that regularexpression if it has not already been written. For instance in thelast
    updated spider2jato.xml file there is already aCSpider.getCommonPage("X")
    rule:
    <!--getPage to getViewBean-->
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[getViewBean($1ViewBean.class]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    Following this example a getDataObject to getModel would look
    like this:
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[getModel($1Model.class]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    In fact, one migration developer already wrote that rule andsubmitted it
    for inclusion in the basic set. I will post another upgrade to thebasic
    regular expression rule set, look for a "file uploaded" posting.Also,
    please consider contributing any additional generic rules that youhave
    written for inclusion in the basic set.
    Please not, that in some cases (Utility classes in particular)
    the rule
    application may be more effective as TWO sequention rules ratherthan one
    monolithic rule. Again using the example above, it will convert
    CSpider.getDataObject("Foo");
    To
    getModel(FooModel.class);
    Now that is the most effective conversion for that code if that
    code is in
    a page or data object class file. But if that code is in a Utilityclass you
    really want:
    >
    RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
    So to go from
    getModel(FooModel.class);
    To
    RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
    You would apply a second rule AND you would ONLY run this rule
    against
    your utility classes so that you would not otherwise affect yourViewBean
    and Model classes which are completely fine with the simplegetModel call.
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[getModel\(]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[getModel\(]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[RequestManager.getRequestContext().getModelManager().getModel(]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    A similer rule can be applied to getSession and other CSpider APIcalls.
    For instance here is the rule for converting getSession calls toleverage
    the RequestManager.
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[getSession\(\)\.]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[getSession\(\)\.]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[RequestManager.getSession().]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    ----- Original Message -----
    From: "Matthew Stevens" <matthew.stevens@e...>
    Sent: Tuesday, August 07, 2001 12:56 PM
    Subject: RE: [iPlanet-JATO] Use Of models in utility classes
    Namburi,
    I will post a document to the group site this evening which has
    the
    details
    on various tactics of migrating these type of utilities.
    Essentially,
    you
    either need to convert these utilities to Models themselves or
    keep the
    utilities as is and simply use the
    RequestManager.getRequestContext.getModelManager().getModel()
    to statically access Models.
    For CSpSelect.executeImmediate() I have an example of customhelper
    method
    as a replacement whicch uses JDBC results instead of
    CSpDBResult.
    matt
    -----Original Message-----
    From: vnamboori@y... [mailto:<a href="/group/SunONE-JATO/post?protectID=081071113213093190112061186248100208071048">vnamboori@y...</a>]
    Sent: Tuesday, August 07, 2001 3:24 PM
    Subject: [iPlanet-JATO] Use Of models in utility classes
    Hi All,
    In the present ND project we have lots of utility classes.
    These
    classes in diffrent directory. Not part of nd pages.
    In these classes we access the dataobjects and do themanipulations.
    So we access dataobjects directly like
    CSpider.getDataObject("do....");
    and then execute it.
    Since the migration tool does not do much of conversion forthese
    utilities we have to do manually.
    My question is Can we access the the models in the postmigration
    sameway or do we need requestContext?
    We have lots of utility classes which are DataObjectintensive. Can
    someone suggest a better way to migrate this kind of code.
    Thanks
    Namburi
    [email protected]
    [email protected]
    [Non-text portions of this message have been removed]
    [email protected]
    [email protected]

    Namburi,
    When you said you used the Reg Exp tool, did you use it only as
    preconfigured by the iMT migrate application wizard?
    Because the default configuration of the regular expression tool will only
    target the files in your ND project directories. If you wish to target
    classes outside of the normal directory scope, you have to either modify the
    "Source Directory" property OR create another instance of the regular
    expression tool. See the "Tool" menu in the iMT to create additional tool
    instances which can each be configured to target different sets of files
    using different sets of rules.
    Usually, I utilize 3 different sets of rules files on a given migration:
    spider2jato.xml
    these are the generic conversion rules (but includes the optimized rules for
    ViewBean and Model based code, i.e. these rules do not utilize the
    RequestManager since it is not needed for code running inside the ViewBean
    or Model classes)
    I run these rules against all files.
    See the file download section of this forum for periodic updates to these
    rules.
    nonProjectFileRules.xml
    these include rules that add the necessary
    RequestManager.getRequestContext(). etc prefixes to many of the common
    calls.
    I run these rules against user module and any other classes that do not are
    not ModuleServlet, ContainerView, or Model classes.
    appXRules.xml
    these rules include application specific changes that I discover while
    working on the project. A common thing here is changing import statements
    (since the migration tool moves ND project code into different jato
    packaging structure, you sometime need to adjust imports in non-project
    classes that previously imported ND project specific packages)
    So you see, you are not limited to one set of rules at all. Just be careful
    to keep track of your backups (the regexp tool provides several options in
    its Expert Properties related to back up strategies).
    ----- Original Message -----
    From: <vnamboori@y...>
    Sent: Wednesday, August 08, 2001 6:08 AM
    Subject: [iPlanet-JATO] Re: Use Of models in utility classes - Pease don't
    forget about the regular expression potential
    Thanks Matt, Mike, Todd
    This is a great input for our migration. Though we used the existing
    Regular Expression Mapping tool, we did not change this to meet our
    own needs as mentioned by Mike.
    We would certainly incorporate this to ease our migration.
    Namburi
    --- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
    All--
    Great response. By the way, the Regular Expression Tool uses thePerl5 RE
    syntax as implemented by Apache OROMatcher. If you're doing lotsof these
    sorts of migration changes manually, you should definitely buy theO'Reilly
    book "Mastering Regular Expressions" and generate some rules toautomate the
    conversion. Although they are definitely confusing at first,regular
    expressions are fairly easy to understand with some documentation,and are
    superbly effective at tackling this kind of migration task.
    Todd
    ----- Original Message -----
    From: "Mike Frisino" <Michael.Frisino@S...>
    Sent: Tuesday, August 07, 2001 5:20 PM
    Subject: Re: [iPlanet-JATO] Use Of models in utility classes -Pease don't
    forget about the regular expression potential
    Also, (and Matt's document may mention this)
    Please bear in mind that this statement is not totally correct:
    Since the migration tool does not do much of conversion for
    these
    utilities we have to do manually.Remember, the iMT is a SUITE of tools. There is the extractiontool, and
    the translation tool, and the regular expression tool, and severalother
    smaller tools (like the jar and compilation tools). It is correctto state
    that the extraction and translation tools only significantlyconvert the
    primary ND project objects (the pages, the data objects, and theproject
    classes). The extraction and translation tools do minimumtranslation of the
    User Module objects (i.e. they repackage the user module classes inthe new
    jato module packages). It is correct that for all other utilityclasses
    which are not formally part of the ND project, the extraction and
    translation tools do not perform any migration.
    However, the regular expression tool can "migrate" any arbitrary
    file
    (utility classes etc) to the degree that the regular expressionrules
    correlate to the code present in the arbitrary file. So first andforemost,
    if you have alot of spider code in your non-project classes youshould
    consider using the regular expression tool and if warranted adding
    additional rules to reduce the amount of manual adjustments thatneed to be
    made. I can stress this enough. We can even help you write theregular
    expression rules if you simply identify the code pattern you wish to
    convert. Just because there is not already a regular expressionrule to
    match your need does not mean it can't be written. We have notnearly
    exhausted the possibilities.
    For example if you say, we need to convert
    CSpider.getDataObject("X");
    To
    RequestManager.getRequestContext().getModelManager().getModel(XModel.class);
    Maybe we or somebody else in the list can help write that regularexpression if it has not already been written. For instance in thelast
    updated spider2jato.xml file there is already aCSpider.getCommonPage("X")
    rule:
    <!--getPage to getViewBean-->
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[getViewBean($1ViewBean.class]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    Following this example a getDataObject to getModel would look
    like this:
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[getModel($1Model.class]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    In fact, one migration developer already wrote that rule andsubmitted it
    for inclusion in the basic set. I will post another upgrade to thebasic
    regular expression rule set, look for a "file uploaded" posting.Also,
    please consider contributing any additional generic rules that youhave
    written for inclusion in the basic set.
    Please not, that in some cases (Utility classes in particular)
    the rule
    application may be more effective as TWO sequention rules ratherthan one
    monolithic rule. Again using the example above, it will convert
    CSpider.getDataObject("Foo");
    To
    getModel(FooModel.class);
    Now that is the most effective conversion for that code if that
    code is in
    a page or data object class file. But if that code is in a Utilityclass you
    really want:
    >
    RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
    So to go from
    getModel(FooModel.class);
    To
    RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
    You would apply a second rule AND you would ONLY run this rule
    against
    your utility classes so that you would not otherwise affect yourViewBean
    and Model classes which are completely fine with the simplegetModel call.
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[getModel\(]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[getModel\(]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[RequestManager.getRequestContext().getModelManager().getModel(]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    A similer rule can be applied to getSession and other CSpider APIcalls.
    For instance here is the rule for converting getSession calls toleverage
    the RequestManager.
    <mapping-rule>
    <mapping-rule-primarymatch>
    <![CDATA[getSession\(\)\.]]>
    </mapping-rule-primarymatch>
    <mapping-rule-replacement>
    <mapping-rule-match>
    <![CDATA[getSession\(\)\.]]>
    </mapping-rule-match>
    <mapping-rule-substitute>
    <![CDATA[RequestManager.getSession().]]>
    </mapping-rule-substitute>
    </mapping-rule-replacement>
    </mapping-rule>
    ----- Original Message -----
    From: "Matthew Stevens" <matthew.stevens@e...>
    Sent: Tuesday, August 07, 2001 12:56 PM
    Subject: RE: [iPlanet-JATO] Use Of models in utility classes
    Namburi,
    I will post a document to the group site this evening which has
    the
    details
    on various tactics of migrating these type of utilities.
    Essentially,
    you
    either need to convert these utilities to Models themselves or
    keep the
    utilities as is and simply use the
    RequestManager.getRequestContext.getModelManager().getModel()
    to statically access Models.
    For CSpSelect.executeImmediate() I have an example of customhelper
    method
    as a replacement whicch uses JDBC results instead of
    CSpDBResult.
    matt
    -----Original Message-----
    From: vnamboori@y... [mailto:<a href="/group/SunONE-JATO/post?protectID=081071113213093190112061186248100208071048">vnamboori@y...</a>]
    Sent: Tuesday, August 07, 2001 3:24 PM
    Subject: [iPlanet-JATO] Use Of models in utility classes
    Hi All,
    In the present ND project we have lots of utility classes.
    These
    classes in diffrent directory. Not part of nd pages.
    In these classes we access the dataobjects and do themanipulations.
    So we access dataobjects directly like
    CSpider.getDataObject("do....");
    and then execute it.
    Since the migration tool does not do much of conversion forthese
    utilities we have to do manually.
    My question is Can we access the the models in the postmigration
    sameway or do we need requestContext?
    We have lots of utility classes which are DataObjectintensive. Can
    someone suggest a better way to migrate this kind of code.
    Thanks
    Namburi
    [email protected]
    [email protected]
    [Non-text portions of this message have been removed]
    [email protected]
    [email protected]

Maybe you are looking for

  • Adobe Acrobat  9 Pro - How can I speed up my Batch Processing sequence

    Adobe Acrobat 9 Pro Version 9.0.0 My company upgraded from Adobe Acrobat 7 to Acrobat 9 recently. Now, whenever I run a batch sequence on one 2003 Word file, it takes over 20 minutes - that's one Word doc. Before with version 7, it took only a few mi

  • Connection timed out problem?

    when i was executing a jsp-jdbc program, i encountered a server error: javax.servlet.ServletException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException:

  • TV problems (resolution)

    okay  so ive got this flat panel tv thats connected to my pc by VGA     the system says its 'unknown' and wont enable the 1360x768 resolution on it   and when i try to xrandr it  the tv says sync out of bounds     it was working until i reduced the r

  • Is the hp Pavilion 762c desktop computer upgradeable to Windows 7?

    I like my hp Pavilion 762c desktop computer. Is it feasable to upgrade to Windows 7? I have many useful programs, pictures, and files installed on it. I want to network it with my new Windows 7 computer.

  • S in SEP - device description

    You know, when IP phone is configured, its description was autogenerated with mac addr and SEP prepend to it. One of our customer asked me what SEP stand for. My guess for EP is ethernet phone. Never know what S stand for. Hopefully it is not infamou