Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/22/2020 in all areas

  1. The delimiters don't matter really, though by using # you could skip escaping the / in the expression. Normally I'd probably use something other than / as well in a situation like this just to avoid that escape, but I was to lazy to change them on the website. You need the start and end of string anchors though if you want to enforce the value strictly. Without them it just looks for the pattern somewhere in the string, not that the string is exactly that pattern. So your regex would also match if: $_POST['ay'] = 'I want to attend in the (2020/21) academic year';
    1 point
  2. Personally, I wouldn't expect the user to enter the corrrect format. And even if the format is correct there is no guarantee that the value is valid E.G. (2020/19) or (2020/22) I would ask the user to enter the "2020" part and then generate the required format $input = 2000; $ay = sprintf("(%4d/%02d)", $input, ($input+1)%100); echo $ay; //--> (2000/01) My 0.02 worth. @kicken, I definitely come bottom of the class when it comes to regex and avoid it like the plague. However, as I was asked about this problem, I gave it go and eventually came up with a pattern of '#\(\d{4}\/\d{2}\)#' which appeared to do the job. My delimiters are different from yours, so is it wrong?
    1 point
  3. If you want the entire string to be in that format, you need to use the start (^) and end ($) anchors and put your pattern in between. Your regex currently also only looks for digits and /, but they can be in any order. If you want to enforce that strict format you need to look 4 digits followed by a slash followed by 2 more digits. Given the above, you end up with a regex such as /^\(\d{4}\/\d{2}\)$/
    1 point
  4. What does your form code look like?
    1 point
  5. Which "index" does the error message refer to? What is the error message? Side note: if you're not doing so already, you'll want to look into password security. More information can be found here: https://www.php.net/manual/en/faq.passwords.php
    1 point
  6. Pretty sure nobody has an email address 65,535 characters long. Nor 150 either, for that matter. The technical limit is 320, but if you find someone complaining that their 151-character long email address isn't working in your system, you can deal with it then.
    1 point
  7. I thought it was perhaps an "Illiteracy filter" service offered by the site. Would you hire someone who can't read simple instructions?
    0 points
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.