regex.nut 352 B

1234567891011
  1. local ex = regexp("[a-zA-Z]+");
  2. local string = "123 Test; strlen(str);";
  3. local res = ex.search(string);
  4. print(string.slice(res.begin,res.end)); //prints "Test"
  5. print("\n");
  6. ex = regexp(@"\m()");
  7. string = "123 Test; doSomething(str, getTemp(), (a+(b/c)));";
  8. res = ex.search(string);
  9. print(string.slice(res.begin,res.end)); //prints "(...)"
  10. print("\n");