Ikibazo gihuza ibibazo · Hagati Urwego

Nigute Wandika Imvugo isanzwe hamwe na AI Ikibazo

Reba neza uko usobanura imiterere ya AI, inanga ya regex hamwe na flavours nka RE2, hamwe no kugerageza guhuza umururumba no gusubira inyuma.

Ikibazo 1 Bya 8

Ni ukubera iki \ d {5} idafite inanga uburyo bubi bwo kwemeza kode ya ZIP?

Reba buri kibazo8 ibibazo

Ibisubizo nibisobanuro bigaragara mugihe ufata ikibazo.

  1. Ni ukubera iki \ d {5} idafite inanga uburyo bubi bwo kwemeza kode ya ZIP?
    • 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
  2. Niki icyifuzo cyiza cya regex kuri AI gikubiyemo?
    • 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
  3. Impapuro Google ikoresha moteri ya RE2. Niki RE2 isiga nkana?
    • Backreferences and lookaround
    • Character classes like [A-Z]
    • Anchors like ^ and $
    • Quantifiers like + and *
  4. Gusubira inyuma ni ibiki?
    • 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
  5. Bikoreshwa mubyanditswe "<a> <b>", ni ubuhe buryo bwo kurarikira <. *> Bihuye?
    • Only "<a>"
    • Nothing at all
    • Only "<b>"
    • The whole string "<a><b>"
  6. 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
  7. 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
  8. Which Python function requires the entire string to match the pattern?
    • re.fullmatch
    • re.search
    • re.findall
    • re.sub