Κουίζ που συνδέεται με οδηγό · Μεσαίο Επίπεδο
Πώς να γράψετε κανονικές εκφράσεις με το κουίζ AI
Ελέγξτε την κατανόηση των μοτίβων περιγραφής της τεχνητής νοημοσύνης, των regex άγκυρων και των γεύσεων όπως το RE2, και των δοκιμών για άπληστους αγώνες και καταστροφικές οπισθοδρομήσεις.
Ερώτηση 1 του 8
Γιατί το \d{5} χωρίς άγκυρες είναι κακό μοτίβο για την επικύρωση ενός ταχυδρομικού κώδικα;
Προεπισκόπηση κάθε ερώτησης8 ερωτήσεις
Οι απαντήσεις και οι εξηγήσεις εμφανίζονται καθώς κάνετε το κουίζ.
- Γιατί το \d{5} χωρίς άγκυρες είναι κακό μοτίβο για την επικύρωση ενός ταχυδρομικού κώδικα;
- It only matches letters, not digits
- It can match five digits inside a longer string like "1234567"
- It is invalid syntax in most engines
- It requires a special Unicode flag to work
- Τι πρέπει να περιλαμβάνει ένα καλό αίτημα regex σε ένα AI;
- A request for the shortest possible pattern
- The name of your company and project
- A promise that you will test it later
- Examples that should and should not match, plus the regex flavor you use
- Το Google Sheets χρησιμοποιεί τον κινητήρα RE2. Τι αφήνει εσκεμμένα έξω το RE2;
- Backreferences and lookaround
- Character classes like [A-Z]
- Anchors like ^ and $
- Quantifiers like + and *
- Τι είναι η καταστροφική οπισθοδρόμηση;
- A regex running out of memory on very short strings
- A regex tester highlighting the wrong characters
- Exponential slowdown on patterns like (a+)+ when input almost matches
- A regex that always returns an empty match
- Εφαρμόζεται στο κείμενο "<a><b>", τι ταιριάζει με το άπληστο μοτίβο <.*>;
- Only "<a>"
- Nothing at all
- Only "<b>"
- The whole string "<a><b>"
- What does the guide suggest for validating email addresses?
- Use one perfect regex that implements the full email standard
- Use a simple sanity check plus a confirmation email
- Never validate email addresses at all
- Rely on lookbehind to check the domain
- For parsing HTML, JSON or other nested structures, what does the guide recommend?
- A longer and more detailed regex
- Using lazy quantifiers everywhere
- A real parser built for that format
- Switching to the RE2 engine
- Which Python function requires the entire string to match the pattern?
- re.fullmatch
- re.search
- re.findall
- re.sub