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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:37:41+00:00 2026-05-16T21:37:41+00:00

I want to find words inside text, where word contains only preselected character set.

  • 0

I want to find words inside text, where word contains only preselected character set.

For example: I use regex to split on characters not in set and remove entries that are empty

Like:

string inp = @"~T!@#e$мудак%š^t<>is69&.,;((טעראָר))_+}{{男子}[죽은]ที่เดิน:?/Ök\|`'+*-¤=";
string reg[] = {"[^A-Za-zšžõäöüŠŽÕÄÖÜ]"};

foreach (string word in inp.Split(reg, StringSplitOptions.RemoveEmptyEntries))
    Console.Write(word + " ");

Output, that I am trying to get, is:

 T e š t is Ök
  • 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-16T21:37:41+00:00Added an answer on May 16, 2026 at 9:37 pm

    You want Regex.Split(String, String) instead of String.Split(String[], StringSplitOptions) – the latter does no regex matching.

    Kind of like the following (tested):

    string inp = @"~T!@#e$мудак%š^t<>is69&.,;((טעראָר))_+}{{男子}[죽은]ที่เดิน:?/Ök\|`'+*-¤="; 
    string reg = "[^A-Za-zšžõäöüŠŽÕÄÖÜ]";
    
    foreach (string word in Regex.Split(inp, reg))  
        if (word != string.Empty)
            Console.Write(word + " ");
    

    PowerShell test:

    PS> $inp = '~T!@#e$мудак%š^t<>is69&.,;((טעראָר))_+}{{男子}[죽은]ที่เดิน:?/Ök\|`''+*-¤='
    PS> $inp -split '[^A-Za-zšžõäöüŠŽÕÄÖÜ]' -join ' '
     T   e š t  is                                      Ök
    

    Obviously you need to filter out the empty strings, so either

    PS> $inp -split '[^A-Za-zšžõäöüŠŽÕÄÖÜ]' -ne '' -join ' '
    T e š t is Ök
    

    or

    PS> $inp -split '[^A-Za-zšžõäöüŠŽÕÄÖÜ]+' -join ' '
     T e š t is Ök
    

    (although the latter still contains an empty item at the start … ah well, I’ll leave that to you.)

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

Sidebar

Related Questions

Given a word W, I want to find all words containing the letters in
I want to find all the demo words using PHP and regEx. $input ='demo';
I want a regex pattern to find all the words of this format [xyzblab23la].
I want to implement Find mechanism (like text editors or word) in my JTextPane.
I have n documents and want to find common words that are included in
I want to find first 4 words and last 4 words after the particular
I have some words in my database. I want to find all the words
So say that I want to find the word Hello, world! on a webpage.
I want to find files containing the word navbar anywhere in files. I can
I want to find files in local directory which contain word: fgrep word *

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.