C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# find string that consists only of a certain set of characters

By : sam
Date : November 17 2020, 01:00 AM
With these it helps Put the characetrs a,b,c inside a character class and make the cahr class to repeat one or more times by adding a + quantifier next to that character class.
code :
``````^[abc]+\$
``````

Share :

## Easiest way of checking if a string consists of unique characters?

By : Rick Ma
Date : March 29 2020, 07:55 AM
this will help I don't like 1. -- it's an O(N2) algorithm. Your 2. is roughly linear, but always traverses the entire string. Your 3. is O(N lg2 N), with (probably) a relatively high constant -- probably almost always slower than 2.
My preference, however, would be when you try to insert a letter into the set, check whether it was already present, and if it was, you can stop immediately. Given random distribution of letters, this should require scanning only half the string on average.

## Best way/algorithm to find out if a string consists of only a given set of characters

By : Bhagat Singh
Date : March 29 2020, 07:55 AM
I wish this helpful for you EDIT: to Luc Touraille for a vast improvement to the original algorithm.
Create an array a[10] of booleans. For each expected digit e, set a[e] = true.

## A method that checks if a String consists of certain characters

By : vivek singh
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I need to make a method that checks if a given String only consists of lower- and uppercase letters, numbers, dots (.), hyphens (-) and underscores ( ). , Use regular expressions:
code :
``````String s = "Your_string-123.";
Pattern p = Pattern.compile("([a-zA-Z]|[0-9]|\\.|\\-|_)+");
Matcher m = p.matcher(s);
if (m.matches()) {
System.out.println(true);
}
``````

## Scala Regexp: find all matches in a string that contain predefined token or any word wich consists of 2-4 characters

By : Ruishan He
Date : March 29 2020, 07:55 AM
I wish this help you Don't believe the naysayers. This can quite easily be done with regex:
code :
``````(?!\w+(?:AB|BCC|CDD)-)[A-Z]{2,4}-
``````
``````(?!                assert that there is no...
\w+             ...sequence of characters...
(?:AB|BCC|CDD)  ...followed by AB, BCC, or CDD...
-               ...and a dash
)
[A-Z]{2,4}-        then simply match 2 to 4 characters before a dash
``````

## Why they say a character string consists of up to eight characters in NASM?

By : razzak
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further The NASM manual says: , It all stemmed from this