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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:50:14+00:00 2026-06-05T06:50:14+00:00

I have a sentence like: Name: JOHN J. SMITH Sometag: How would I grab

  • 0

I have a sentence like:

Name: JOHN J. SMITH Sometag:

How would I grab the JOHN J SMITH part?

Sometag is not always the same so it would be more like get all all-capitalized words until one that is not.

UPDATE

"[A-Z. ]*" returns JOHN J. SMITH S
"[A-Z. ]*\b" returns nothing as well as
"\b[A-Z. ]*\b"

  • 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-06-05T06:50:15+00:00Added an answer on June 5, 2026 at 6:50 am

    Try this

    [A-Z. ]*\b
    

    Let me know how it goes

    You can be be more complete with this one

    [\p{Lu}\p{M}\p{Z}\p{N}\p{P}\p{S}]*\b
    

    But its a mouthful

    Match a single character present in the list below «[\p{Lu}\p{M}\p{Z}\p{N}\p{P}\p{S}]*»
       Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
       A character with the Unicode property “uppercase letter” (an uppercase letter that has a lowercase variant) «\p{Lu}»
       A character with the Unicode property “mark” (a character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.)) «\p{M}»
       A character with the Unicode property “separator” (any kind of whitespace or invisible separator) «\p{Z}»
       A character with the Unicode property “number” (any kind of numeric character in any script) «\p{N}»
       A character with the Unicode property “punctuation” (any kind of punctuation character) «\p{P}»
       A character with the Unicode property “symbol” (math symbols, currency signs, dingbats, box-drawing characters, etc.) «\p{S}»
    Assert position at a word boundary «\b»
    

    Or shorter

    \P{Ll}*\b
    

    Update 1

    After your edit I would use this

    Name: (\P{Ll}*)[ ]
    

    The desired match will be in group 1. Note that I added a [ ] in the end so to signal a single space. You can convert this character class to a space if you want.

    In C# this becomes

    string resultString = null;
    try {
        Regex regexObj = new Regex(@"Name: (\p{Ll}*)[ ]");
        resultString = regexObj.Match(subjectString).Groups[1].Value;
    } catch (ArgumentException ex) {
        // Syntax error in the regular expression
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider a sentence like: John Smith travelled to Washington. A name tagger would identify,
This is my string: this is my sentence I would like to have this
I have a notepad with in fix format sentence like name... Image... Text... I
I have sentence like Q 000 1111 00001 0001 00 //SOME_STRING I wanted to
I have a sentence like this. 1       2     3
I have a varargs constructor like this : public class Sentence { public String[]
I have a file like this: This is a sentence. This is another sentence.
I have the following sentence #bb John can #20 jiang stone [voila] I want
I have to split the word in a sentence which contains more than 40
I have a text like this: My name is Bob and I live in

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.