Forum Moderators: open
At the user's discretion I want to avoid spell checking any words with numbers in them.
I'm pretty good with fairly simple regular expressions but I'm having trouble constructing a single pattern that will allow me to find all words that have at least one number anywhere in them so that I can remove them from the list of words that need to be spell checked.
In otherwords, the pattern should find each of the following examples: 1ABC, 99ABC, ABC1, ABC99, ABC1D, and ABC99D.
Is the above possible or will I need to use three separate patterns?
Thanks in advance for any help.
dim input
dim input_words
dim reLetters
dim reNumbers
set reLetters = new RegExp
set reNumbers = new RegExp
reLetters.IgnoreCase = True
reLetters.Pattern = "a¦b¦c¦d¦e¦f¦g¦h¦i¦j¦k¦l¦m¦n¦o¦p¦q¦r¦s¦t¦u¦v¦w¦x¦y¦z"
reNumbers.IgnoreCase = True
reNumbers.Pattern = "1¦2¦3¦4¦5¦6¦7¦8¦9¦0"
'get your input from wherever
'input = request("input")
input = "im a little 666 tea pot sh0rt and stout"
if not input = "" then
'split the input
input_words = split(input & " ", " ")
c = 0
while c < ubound(input_words)
'perform a test on the word to see if it's got numbers in it
'up to you how you do this.
if (reNumbers.Test(input_words(c)) = true and reLetters.Test(input_words(c)) = true) then
'you have a word with letters and numbers
response.write input_words(c)
end if
c = c + 1
wend
end if
set reNumbers = nothing
set reLetters = nothing
You're looking for something that will get all words containing a number from a text and remove them. Okay. Can't you use the opposite instead - return and keep all words that don't have a number in them?
^[a-zA-Z]+$ No?
//ZS
Thanks for your suggestion. I'll give it a try but the logic is totally opposite of what I'm trying to do so I'm not sure it will work.
Basically what I'm trying to do is take a message like this one, strip out HTML, URLs, and anything else that doesn't need to be spell checked (like words with numbers in them) and then spell check what I have left.