Skip to content

Conversation

@RocketRide9
Copy link

@albfan
Copy link

albfan commented Oct 14, 2025

I tried a real example and here:

$ vala --version
Vala 0.56.18

o is not accepted:

void main (string[] args) {

  /*
    i, letters in the pattern match both upper- and lowercase letters
    m, the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the string, respectively, as well as at the very start and end.
    s, a dot metacharater . in the pattern matches all characters, including newlines. Without it, newlines are excluded.
    x, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class.
    o, request JIT compilation of a regular expression. 
       It allows to execute this regex much faster at the cost of extra time taken to compile it. This option is most benificial, when the same compiled pattern is used for matching several times.
  */

  var r = /foo/;
  print ("%s\n", r.replace ("1 this foo is great", -1, 0, "bar"));
  print ("%s\n", r.replace ("2 this Foo is great", -1, 0, "bar"));
  r = /foo/i;
  print ("%s\n", r.replace ("3 this Foo is great", -1, 0, "bar"));
  r = /foo$/i;
  print ("%s\n", r.replace ("4 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo$/m;
  print ("%s\n", r.replace ("5 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo.*/;
  print ("%s\n", r.replace ("6 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo.*/s;
  print ("%s\n", r.replace ("7 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo /;
  print ("%s\n", r.replace ("8 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo /x;
  print ("%s\n", r.replace ("9 this foo is great.But foo\nis better.", -1, 0, "bar"));
  r = /foo/o;
  print ("%s\n", r.replace ("9 this foo is great.But foo\nis better.", -1, 0, "bar"));
}

but other flags work (g and u do not work too)

so maybe remove o and merge?

Before:
image

After:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants