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 2 of 2

Thread: Everything Between Two Keywords

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Everything Between Two Keywords

    Greetings,

    In Microsoft Word, I can use the wildcard " * " to search for anything (characters, numbers, white space of every kind, line breaks of every kind, etc.) appearing between any two words of my choosing.

    I am trying to do the same thing with Java regular expressions; thus far, I find nothing equivalent to the MS Word " * " wildcard.

    Is there an equivalent regular expression in Java?

    Using " .* " in a Java regular expression will extend only to a single line of text -- it "quits" upon reaching a line break.

    I have read somewhere that in Java regular expressions, the dot (" . ") matches any character except line breaks.

    My question is this: Is there a Java representation -- analogous to the " * " wildcard in MS Word -- that encompasses (a) any character and also (b) all line breaks, etc.?

    Thank you for your time and attention.

    BB Smith.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Everything Between Two Keywords

    Similar post here: https://coderanch.com/t/690762/java/...ressions-Words
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Searching with keywords in a sentence
    By sengreen in forum Loops & Control Statements
    Replies: 4
    Last Post: April 20th, 2013, 10:17 PM
  2. [SOLVED] replacing few keywords with corresponding operators
    By shenaz in forum Java Theory & Questions
    Replies: 14
    Last Post: April 9th, 2013, 11:54 AM
  3. keywords
    By BLUEJ in forum Java Theory & Questions
    Replies: 5
    Last Post: January 14th, 2013, 08:05 PM
  4. Can you name the Java keywords?
    By KevinWorkman in forum The Cafe
    Replies: 7
    Last Post: November 19th, 2011, 06:13 PM
  5. keywords
    By crazyjava in forum Java Theory & Questions
    Replies: 2
    Last Post: September 29th, 2010, 12:13 AM

Tags for this Thread