• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] Sscanf problem
#6
Search works fine, but you don't want search. `s` can contain `@`, so if you type `[email protected]` sscanf will do the following:



`s[32]` - Gathers everything until the first separator (whitespace by default), so `[email protected]`.

`'@'` - Looks for another `@`, but there isn't one, so the check fails.



You are missing up searches and delimiters. sscanf doesn't have look-ahead/look-behind, so while it is reading a string it doesn't know that the NEXT instruction is to look for an `@`. You've not told sscanf to stop reading strings at `@`, so it doesn't. You want:



"p<@>s[32]s[32] "



(you also don't want to check for a `.`, as valid e-mail addresses don't have to have one. Really all you want is `strfind(input, "@") != -1` - that's the simplest way to look for a valid e-mail address. Of course the only truly correct way is to send an e-mail it it.
  Reply


Messages In This Thread
Sscanf problem - by Pinch - 2020-08-27, 07:50 PM
RE: Sscanf problem - by Tama - 2020-08-27, 09:10 PM
RE: Sscanf problem - by Pinch - 2020-08-27, 09:41 PM
RE: Sscanf problem - by Tama - 2020-08-28, 07:49 AM
RE: Sscanf problem - by Pinch - 2020-08-28, 09:20 AM
RE: Sscanf problem - by Y_Less - 2020-09-23, 11:50 AM

Forum Jump: