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 1064523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:57:07+00:00 2026-05-16T18:57:07+00:00

I am trying to get a regular expression that will match on any of

  • 0

I am trying to get a regular expression that will match on any of the following strings:

Sales Director:
Managing Director:
Sales Manager:
General Manager - Power:
Finance Director:
Procurement Manager:
Director:
Director:
Managing Director:
Finance Director:
Sales Director:
Managing Director:
Sales Manager:
Finance Director:
Procurement Manager:

But not on:

print directories and guides
defence Industry Directory

so far I have:

/(manager|director)/i

But this is obviously going to match on directories, directory etc.

I know the $ sign signifies the end of a word but I cannot get the right syntax.

Should I be using word boundaries like \b?

I also DO NOT want to pull back whole sentences with manager or director in the sentence. I think I want a maximum of 2 words where manager or directory is the first or second word. Is this possible?

Can anyone point me in the right direction?

  • 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-16T18:57:09+00:00Added an answer on May 16, 2026 at 6:57 pm

    Should I be using word boundaries like \b?

    Yes, you need word boundaries here:

    /\b(manager|director)\b/i
    

    I think I want a maximum of 2 words where manager or director is the first or second word. Is this possible?

    Yes, you can do this with a single regular expression (rubular):

    /^(?:\w+ +)?(manager|director)\b/i
    

    This searches for either:

    • the word manager or director at the beginning of the line or
    • one word, one or more spaces, then the word manager or director
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate a regular expression match in Java, that accepts all
With PHP I'm trying to get my regular expression to match both template references
I'm trying to write a regular expression that will convert a full path filename
I am trying to match {{anything}} using the regular expression /\{\{.*\}\}/ But it will
I am trying to get a regular expression to work, but not having a
I am trying to get a working regular expression to convert standard HTML code
I am trying to get a regular query appended to any clean URL to
Is there a way to write a regular expression pattern that will create one
I am trying to write a regular expression that can parse the text between
I am trying to write a regular expression to match ruby's list and hash

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.