Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:51:50+00:00 2026-05-23T14:51:50+00:00

I am finding it a bit difficult to wrap my head around prefix and

  • 0

I am finding it a bit difficult to wrap my head around prefix and suffix lookups in regular expressions. I am practicing and want to do the following:

Given a string: “James is good”. I want to be able to match the maximal substring in-order, i.e get a match if the text is “James”or “James is” or “James is good”. So if I have the following text: “James James is James”, I should be able to capture “James is” and not just “James”. Simalrly ” is James James is Good James” should give me “James is Good” and not “is James” as it is out of order and not maximal

I think i can use suffix is not present(?!), to match, say only “James” if “is good” is not present and so on, but I am not sure if I understand the concept of prefix and suffix matching correctly.

Any clarification or help in this case would be great. I tagged java because I am familiarizing myself with java’s regex api.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:51:50+00:00Added an answer on May 23, 2026 at 2:51 pm

    I am not sure, but I assume you are talking about look behind and look ahead assertions.

    An assertion has zero length and is matching the empty string, so no characters are matched by this construct. You can use them to match a pattern only if it is preceded or followed by a certain other pattern (or not if you use the negative versions)

    You can check here for more details on regular-expressions.info

    The Perlretut is about Perl, but it works similarly in Java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am finding myself doing the following a bit too often: attr = getattr(obj,
Done a bit of Googling, but not quite finding what I want. In an
I am finding myself working with ObservableCollection quite a bit. I've looked around, but
I've done a bit of searching around and was unsuccessful in finding an ample
I'm new to LINQ and am finding it a bit difficult with understanding some
I'm finding it difficult to determine how to extract the following information from a
I've been playing around a bit finding a way around the start attribute in
Finding windows FastCGI help is proving very difficult. Any help would be greatly apprciated.
Having a bit of difficulty finding out the proper way to mix in code
I'm looking to crowd-source this, as I'm having bit of difficulty finding an industry

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.