String regex = "^\\s+[A-Za-z,;'\"\\s]+[.?!]$"
^
means “begins with”
\\s
means white space
+
means 1 or more
[A-Za-z,;'"\\s]
means any letter, ,
, ;
, '
, "
, or whitespace character
$
means “ends with”
More Related Contents:
- Find the highest number between two literal strings using a Regular Expression
- How to split a string, but also keep the delimiters?
- Match multiline text using regular expression
- Regex to match a C-style multiline comment
- Splitting a string at every n-th character
- Parsing XML with REGEX in Java
- Java – Best way to grab ALL Strings between two Strings? (regex?)
- removing invalid XML characters from a string in java
- How do I convert CamelCase into human-readable names in Java?
- Replacing all non-alphanumeric characters with empty strings
- Extracting pairs of words using String.split()
- What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?
- Java String.split() Regex
- Java – regular expression finding comments in code
- Given a string, generate a regex that can parse *similar* strings
- Regular Expression to match 3 or more Consecutive Sequential Characters and Consecutive Identical Characters
- How to split a comma separated String while ignoring escaped commas?
- pattern.matcher() vs pattern.matches()
- How to handle requests that includes forward slashes (/)?
- String.split() *not* on regular expression?
- java string split on all non-alphanumeric except apostrophes
- Find the first occurrence with Regex
- Java String ReplaceAll method giving illegal repetition error?
- Can java.util.regex.Pattern do partial matches?
- Find all words with 3 letters with regex
- What is a regex “independent non-capturing group”?
- Java regex error – Look-behind group does not have an obvious maximum length
- Parse Date from String in this format : dd/MM/yyyy [to dd/MM/yyyy]
- How can I perform a partial match with java.util.regex.*?
- Java replace all square brackets in a string