I know Nim already can do this (from documentation):
    
    
     line =~ re"\s*(\w+)\s*\=\s*(\w+)":
      # matches a key=value pair:
      echo("Key: ", matches[0])
      echo("Value: ", matches[1])
    elif line =~ re"\s*(\#.*)":
      # matches a comment
      # note that the implicit ``matches`` array is different from the
      # ``matches`` array of the first branch
      echo("comment: ", matches[0])
    else:
      echo("syntax error")
    
    Run

What about the following syntax for regex substitution? Can it be emulated with 
macros ou added to the core language? 
    
    
    string =~ s/regex/replacement/g;
    
    
    Run

It would be great to have regex syntax sugar in the core language. That would 
make Nim even more practical, while still remaining readable.

Reply via email to