Opened 19 years ago
Closed 19 years ago
#1306 closed defect (bug) (wontfix)
Dict lookup regex too restrictive
Reported by: | h3h | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 1.5.1.1 |
Component: | Administration | Keywords: | javasript, dictionary, regex |
Focuses: | Cc: |
Description
On the Write Post screen, one can click the "Dict." button to get a dictionary definition for a selected word or the user will be prompted for a word to get a definition for. If the user presses Cancel in the dialog asking for a word, a new window proceeds to open to answers.com with the world "null".
I've made a simple modification that checks for a null return value from the prompt() function, in addition to a simple regex test that ensures the world is at least one word-character long.
Attachments (3)
Change History (7)
#3
@
19 years ago
[\w ] was too restrictive, as it won't allow hyphenated words or words with apostrophes (and whatever else you can think up). I do think it's reasonable, however, to require the first character of the word typed to be in \w.
After application of this latest patch you can mark this issue resolved, Matt. Thanks.
#4
@
19 years ago
- Keywords javasript dictionary regex added
- Summary changed from Dict lookup continues when cancel is pressed to Dict lookup regex too restrictive
Patch: quicktags.js-unrestrict.patch
Words such as "laissez-faire" are not allowed with the current regex. This patch makes the regex less restrictive
The first patch has an extra parenthesis in it. Use rev2.