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

  • SEARCH
  • Home
  • 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 1115321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:08:22+00:00 2026-05-17T03:08:22+00:00

Ok, here again. I’ll promise to study deeply the regular expression soon :P Language:

  • 0

Ok, here again.
I’ll promise to study deeply the regular expression soon 😛

Language: PhP

Problem:
Match if some badword exist inside a string and do something.
The word must be not included inside a “greater word”. I mean if i’ll search for “rob” (sorry Rob, i’m not thinking you’re a badword), the word “problem have to pass without check.

I’d googled around but found nothing good for me. So, I thought something like this:

If i match the word with after and before any character of the following:

  • .
  • ,
  • ;
  • :
  • !
  • ?
  • (
  • )
  • +
  • –
  • [whitespace]

I can simulate a check against single word inside a string.

Finally the Questions:

  1. There’s a better way to do it?
  2. If not, which will be the correct regexp to consider [all_that_char]word[all_that_char]?

Thanks in advance to anyone would help!
Maybe this is a very stupid question but today is one of that day when move our neurons causes an incredible headache 😐

  • 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-17T03:08:22+00:00Added an answer on May 17, 2026 at 3:08 am

    Look up \b (word boundary):

    Matches at the position between a word
    character (anything matched by \w) and
    a non-word character (anything matched
    by [^\w] or \W) as well as at the
    start and/or end of the string if the
    first and/or last characters in the
    string are word characters.

    (http://www.regular-expressions.info/reference.html)

    So: \brob\b matches rob, but not problem.

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

Sidebar

Related Questions

I have a strange problem, I hope you can help me. I write a
i have a script that once clicked ( a button ) some other thing
I am absolute beginner in C#, ASP.NET and MVC2 and this means that I
Take this example: customer.Salary = Convert.ToDecimal(string.Format({0}! , Console.ReadLine().ToString())); (1) Why in C# we need
Please help me set up proper indentation in Emacs haskell-mode When I'm trying to
I have 10 properties where when each is set it increments the value of
I've been working on this issue for a couple days and have read several
i was trying to run the hello-jni example that comes bundled with the NDK
i was trying to run the hello-jni example that comes bundled with the NDK
I do Drupal for a living and I like the system. However I've always

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.