To match any character except a list of excluded characters, put the excluded charaters between [^ and ] . The caret ^ must immediately follow the [ or else it stands for just itself. The character '. ' (period) is a metacharacter (it sometimes has a special meaning).
There is a method for matching specific characters using regular expressions, by defining them inside square brackets. For example, the pattern [abc] will only match a single a, b, or c letter and nothing else.
. Your regex starts with (?= (ensure that you can see, but don't consume) followed by . * (zero or more of any character).
This is python regex, but it probably works in other languages that implement it, too.
I guess it depends on what you consider a character to be. If it's letters, numbers, and underscores:
\w{3,}
if just letters and digits:
[a-zA-Z0-9]{3,}
Python also has a regex method to return all matches from a string.
>>> import re
>>> re.findall(r'\w{3,}', 'This is a long string, yes it is.')
['This', 'long', 'string', 'yes']
Try this .{3,} this will match any characher except new line (\n)
If you want to match starting from the beginning of the word, use:
\b\w{3,}
\b: word boundary
\w: word character
{3,}: three or more times for the word character
I tried find similiar as topic first post.
For my needs I find this
http://answers.oreilly.com/topic/217-how-to-match-whole-words-with-a-regular-expression/
"\b[a-zA-Z0-9]{3}\b"
3 char words only "iokldöajf asd alkjwnkmd asd kja wwda da aij ednm <.jkakla "
You could try with simple 3 dots. refer to the code in perl below
$a =~ m /.../ #where $a is your string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With