Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Need Regex for a pattern

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Regex for a pattern

    Hello,

    I need a pattern for the following use cases: I am using Java

    1. var so = nokia.device.load('abc','abc');
    2. var so = nokia.device.load("abc","abc");
    3. var so = nokia.device.load("abc");
    4. var so = nokia.device.load('abc');
    // 5. var so = nokia.device.load('abc'); (Line is commentted)
    /*
    function init()
    {
    if (window.menu) {
    // set tab-navigation mode and hide softkeys
    widget.setNavigationEnabled(false);
    var so = nokia.device.load("abc");(Line is commentted)
    }
    */

    I need a regex pattern which will be give me only the function statments which are listed in bold and NOT italic format function statements as those statements are commented.

    Basically, the pattern should give me the statments which are not commented.
    Please help me, its urgent.

    Thanks,
    Mallikarjun.


  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    495
    Thanks
    8
    Thanked 48 Times in 46 Posts

  3. #3
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Need Regex for a pattern

    What have you tried so far and where are you stuck?

    // Json

  4. #4
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need Regex for a pattern

    I am using this pattern

    nokia.device.load..\w*.*

    but this works for all the statements (commented o non-commented).
    I need a pattern, which skips the statement (// 5. var so = nokia.device.load('abc'); (Line is commentted)) which are in the comments.

    Basically, the pattern should give me the statments which are not commented.

    Regards,
    Mallikarjun

  5. #5
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    495
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Need Regex for a pattern

    Don't you think you should inform members here that your question is already answered on another forum? Or maybe it just doesn't bother you that someone may waste time trying to help you with a problem that no longer exists.

    db

  6. #6
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need Regex for a pattern

    I have got answered in other forum. Pattern is ^var *.*nokia[.]device.*[)] *;$

    sorry for the trouble...

    Thank you.

  7. #7
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Need Regex for a pattern

    No worries, thanks for sharing the solution

    // Json

  8. #8
    Junior Member
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: ***Urgent Need Regex for a pattern***

    Hello,
    Need a pattern for the problem. please check the last comment in the below link

    Java Programming - ***Need Regex for a pattern

    its urgent. Any assistance is highly appreciated.

Similar Threads

  1. url pattern issue - please help me...
    By bharathik in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: November 9th, 2009, 04:28 AM
  2. Possible regex problem?
    By Bill_H in forum What's Wrong With My Code?
    Replies: 6
    Last Post: October 25th, 2009, 02:36 AM
  3. Regex Question
    By igniteflow in forum Java SE APIs
    Replies: 1
    Last Post: August 28th, 2009, 12:46 PM
  4. [SOLVED] Java Regular Expressions (regex) Greif
    By username9000 in forum Java SE APIs
    Replies: 4
    Last Post: June 11th, 2009, 06:53 PM
  5. Replies: 1
    Last Post: February 28th, 2009, 10:05 PM