Hi,
I have a text:
I'm using this library: https://www.mql5.com/en/code/16566
Also, here is a regex description: https://www.mql5.com/en/articles/2432
The issue:
If I'm using this regex pattern: "Blue", then I get the word "Blue".
But, if I'm using this regex pattern: "^Blue", then I get nothing.
The ^ means: beginning of the line. The "Blue" is at the beginning of the line.
What is the problem with the "^Blue" pattern? Is it a bug?
Normally it should work. I guess it's a wide character issue, the caret ^ isn't recognized as such. There are some samples using a caret in the Tests.mq4 file (Example5_2, Example9_1) you might want to check.
Thank you. I found the problem: I had to use the Multiline option.
But why? How is this a multi-line text:
Blue cars are everywhere.
But why? How is this a multi-line text:
It was just an example, the original text is multi line (I did not think that it does matter, could be misleading, sorry).
As I figured it out the meaning of ^, if Multiline >> beginning of line, if not Multiline >> beginning of string.
Again: I have problem with the "^".
Now I need to get the beginning of a string. For example my text is:
I want to get the 2 "Big". My regex pattern is "^Big", but I get nothing.
(In this case I did not use the Multiline option.)
What is the solution?
"Now I need to get the beginning of a string."
You don't need a regular expression to find the beginning of a string. The beginning of a string is at [0]. Or did you mean the beginning of a sentence? If so, what constitutes a sentence to you?
"Now I need to get the beginning of a string."
You don't need a regular expression to find the beginning of a string. The beginning of a string is at [0]. Or did you mean the beginning of a sentence? If so, what constitutes a sentence to you?
I think my explanation was clear, maybe you misunderstood. I need the "Big" words in my text, but only those which are whole words.
If my text is:
Big smile! Big pleasure! BigBig ocean!
I want to get the first 2 "Big" (green), but no need for "BigBig" (red).
I couldn't get to work the "^" (beginning of the string) and "$" (end of the string), how should I do it?
I think my explanation was clear, maybe you misunderstood. I need the "Big" words in my text, but only those which are whole words.
If my text is:
I want to get the first 2 "Big" (green), but no need for "BigBig" (red).
I couldn't get to work the "^" (beginning of the string) and "$" (end of the string), how should I do it?
No it wasn't clear. Wrong demo text, same as before. Why didn't you come up with the right description first place?
You're looking for the word boundary. Take a few minutes time and read a regex tutorial.
No it wasn't clear. Wrong demo text, same as before. Why didn't you come up with the right description first place?
You're looking for the word boundary. Take a few minutes time and read a regex tutorial.
The first demo text was also right, because I couldn't know that the Multiline thing will matter.
I know the word boundary \b, but I want to know how should I use the ^ and $. Can you help?
The first demo text was also right, because I couldn't know that the Multiline thing will matter.
I know the word boundary \b, but I want to know how should I use the ^ and $. Can you help?
You know the word boundary, why aren't you using it then ?
I totally agree with lippmaje it was not clear and it's still not. From what you described, you don't need "^" at all. I am even wondering if you need regex at all.
Help with what ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have a text:
I'm using this library: https://www.mql5.com/en/code/16566
Also, here is a regex description: https://www.mql5.com/en/articles/2432
The issue:
If I'm using this regex pattern: "Blue", then I get the word "Blue".
But, if I'm using this regex pattern: "^Blue", then I get nothing.
The ^ means: beginning of the line. The "Blue" is at the beginning of the line.
What is the problem with the "^Blue" pattern? Is it a bug?