kb:zapisi:regex_main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
kb:zapisi:regex_main [2023/08/15 14:32] – [Grouping and capturing — ()] milanokb:zapisi:regex_main [2023/08/15 14:45] – [Greedy and Lazy match] milano
Line 30: Line 30:
 ===== ILI operater — | ili [] ===== ===== ILI operater — | ili [] =====
  
-''a(b|c)'' odgovara nizu koji ima **a** praćeno sa **b** //ili// **c**+''a(b|c)'' odgovara nizu koji ima **a** praćeno sa **b** //ili// **c** \\
 ''a[bc]'' isto kao i prethodni ''a[bc]'' isto kao i prethodni
  
Line 87: Line 87:
 Ako odlučimo da damo ime grupama (koristeći ''(?<foo>…)''), moći ćemo da preuzmemo vrednosti grupe koristeći rezultat podudaranja kao rečnik gde će ključevi biti ime svake grupe . Ako odlučimo da damo ime grupama (koristeći ''(?<foo>…)''), moći ćemo da preuzmemo vrednosti grupe koristeći rezultat podudaranja kao rečnik gde će ključevi biti ime svake grupe .
  
-===== Bracket expressions — [] =====+===== Izrazi zagrade — [] =====
  
-''[abc]'' matches a string that has **either an a or a b or a c** is the **same as a|b|c ** \\ +''[abc]'' podudara se sa nizom koji ima **ili ili ili c** koje je **isto kao a|b|c ** \\ 
-''[a-c]'' same as previous \\ +''[a-c]'' isto kao i prethodni \\ 
-''[a-fA-F0-9]'' a string that represents **a single hexadecimal digitcase insensitively** \\ +''[a-fA-F0-9]'' niz koji predstavlja **jednu heksadecimalnu cifrubez obzira na velika i mala slova** \\ 
-''[0-9]%'' a string that has a character **from to before a sign** \\ +''[0-9]%'' niz koji ima karakter **od do pre znaka %** \\ 
-''[^a-zA-Z]''string that has not a letter from a to or from to Z. In this case the ''^''  is used as **negation of the expression** \\ \\+''[^a-zA-Z]'' niz koji nema slovo od do ili od do Z. U ovom slučaju se ''^'' koristi kao **negacija izraza** \\ \\
  
-Remember that inside bracket expressions all special characters (including the backslash lose their special powersthus we will not apply the escape rule”.+Imajte na umu da svi posebni znakovi unutar izraza u zagradama (uključujući obrnutu kosu crtu​​gube svoja posebna ovlašćenjastoga nećemo primeniti „pravilo bežanja“.
  
-===== Greedy and Lazy match =====+===== Pohlepni i lenji se poklapaju =====
  
-The quantifiers ( ''* + {}''are *greedy operators*, so they expand the match as far as they can through the provided text.+Kvantifikatori ( ''* + {}''su *pohlepni operatori*, tako da proširuju podudaranje koliko god mogu kroz dati tekst.
  
 For example, ''<.+>''  matches ''<nowiki><div>simple div</div></nowiki>''  in ''This is a <nowiki><div>simple div</div></nowiki>'' test. In order to catch only the ''div''  tag we can use a ''?''  to make it lazy \\ For example, ''<.+>''  matches ''<nowiki><div>simple div</div></nowiki>''  in ''This is a <nowiki><div>simple div</div></nowiki>'' test. In order to catch only the ''div''  tag we can use a ''?''  to make it lazy \\
  • kb/zapisi/regex_main.txt
  • Last modified: 2023/08/16 09:11
  • by milano