re = /^(?:#JSGF) (?<version>V1.0) (?<encoding>[A-Z-0-9]+) (?<locale>[a-z]{2}-[A-Z]{2});$/m
str = '#JSGF V1.0 UTF-8 hu-HU;
grammar planmaster.hu;
<command_change_odontogram> = ( <change_to> [ a ] <odontogram_mode> [ felvételére | felvételre ] ) | ( <odontogram_mode> felvétele ) ;
<change_to> = ( váltás | válts | menj | ugrás | ugorj ) ;
<odontogram_mode> = ( státuszra | státuszhoz | státusz ) {state} | ( kezelés | kezelésre | kezeléshez | lépésekre | lépésekhez ) {treatment} ;
<command_full_jaw> = <all> * ( alsó {lower} | felső {upper} ) [ fogsor | állkapocs | fogak | fog ] <all> * <status> ;
<all> = mind | összes | teljes ;
<status> = ( <status1> | <status2> | <status3> ) {status} ;
<status1> = ( ép | alaphelyzet | alaphelyzetbe ) {1} ;
<status2> = ( hiány | hiányzik ) {2} ;
<status3> = [ szekunder ] ( szuvas | szuvasodott | szuvasodás ) {3} ;
<tooth18> = ( 18as | 18-as | tizennyolcas | nyolcas | ( 18 as ) ) {18} ;
<tooth17> = ( 17es | 17-es | tizenhetes | hetes | ( 17 es ) ) {17} ;
<tooth16> = ( 16os | 16-os | tizenhatos | hatos ) {16} ;
<tooth_region> = ( bal {left} | jobb {right} ) ( felső {upper} | alsó {lower} ) ;
<tooth_number> = ( <tooth18> | <tooth17> | <tooth16> | és ) ;
<command_select> = ( ( <tooth_number> + ) | <tooth_region> <tooth_number> + ) [ fog | fogak ] ;
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html