Well, I tried your const string cl_re_strAnyChar but it doesn't work...
I've simplfied my object text.
// object text : "Version 2 : Add some links with link module" (without any EOL nor special characters)
Object curro = current Object
string Text_Version = curro."Object Text"
const string str_anychar = "["charOf(1)"-"charOf(255)"]"
Regexp MyText = regexp2 "([A-Z a-z 0-9]*:)(str_anychar)*"
if (MyText Text_Version)
{
print Text_Version [match(0)] "\n"
print Text_Version [match(1)] "\n"
print Text_Version [match(2)] "\n"
}
// match [0] = "Version 2 :"
// match [1] = "Version 2 :"
// match [2] = ""
Why match (0) and then match(2) are wrong ??
I expected match(0) = "Version 2 : Add some links with link module" and match(2) = "Add some links with link module" Even without EOL and with the const string, the regexp does not match !!!
DOORS is internally using UTF8, which has a much wider set of characters. The char type can hold much more than 255 different characters, but IBM never bothered to correct the "charOf", "intOf" functions.
So the easiest way for your specific regexp, is to remove the "anychar" part from the regex and simply take a substring after the "end 0" match. If you really need anychar, you need to resolve to something like
"[^" + (charOf 1) + "]"
(which assumes that you do not consider chr(1) as a valid character in your text. Hope this helps, Regards, Mathias
DOORS is internally using UTF8, which has a much wider set of characters. The char type can hold much more than 255 different characters, but IBM never bothered to correct the "charOf", "intOf" functions.
<pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">char c = addr_ 339
print c
c = charOf 339
print c
</pre>
So the easiest way for your specific regexp, is to remove the "anychar" part from the regex and simply take a substring after the "end 0" match. If you really need anychar, you need to resolve to something like
This is the accepted answer.
This is the accepted answer.
I don't quite get your regular expression but in DXL you can match newlines in different ways, however the "." placeholder does not match on newlines:
string sText = "\n";
Regexp re1 = regexp "\\\n" // match
Regexp re2 = regexp "\\n" // match
Regexp re3 = regexp "\n" // match
Regexp re4 = regexp "." // no match
if (re1 sText) print "Match re1\n";
if (re2 sText) print "Match re2\n";
if (re3 sText) print "Match re3\n";
if (re4 sText) print "Match re4\n";
Although I don't know what the (\\\\~| *) part of your regexp is supposed to match to, but the following test at least matches in group 1 and 3 (note that you have a space between 'Version 2' and the ':' ...
I don't quite get your regular expression but in DXL you can match newlines in different ways, however the "." placeholder does not match on newlines:
<pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">string sText = "\n";
Regexp re1 = regexp "\\\n" // match
Regexp re2 = regexp "\\n" // match
Regexp re3 = regexp "\n" // match
Regexp re4 = regexp "." // no match
if (re1 sText) print "Match re1\n";
if (re2 sText) print "Match re2\n";
if (re3 sText) print "Match re3\n";
if (re4 sText) print "Match re4\n";
</pre>
Although I don't know what the (\\\\~| *) part of your regexp is supposed to match to, but the following test at least matches in group 1 and 3 (note that you have a space between 'Version 2' and the ':' ...
Well, I tried your const string cl_re_strAnyChar but it doesn't work...
I've simplfied my object text.
// object text : "Version 2 : Add some links with link module" (without any EOL nor special characters)
Object curro = current Object
string Text_Version = curro."Object Text"
const string str_anychar = "["charOf(1)"-"charOf(255)"]"
Regexp MyText = regexp2 "([A-Z a-z 0-9]*:)(str_anychar)*"
if (MyText Text_Version)
{
print Text_Version [match(0)] "\n"
print Text_Version [match(1)] "\n"
print Text_Version [match(2)] "\n"
}
// match [0] = "Version 2 :"
// match [1] = "Version 2 :"
// match [2] = ""
Why match (0) and then match(2) are wrong ??
I expected match(0) = "Version 2 : Add some links with link module" and match(2) = "Add some links with link module" Even without EOL and with the const string, the regexp does not match !!!
Well, I tried your const string cl_re_strAnyChar but it doesn't work...
I've simplfied my object text.
<pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">// object text : "Version 2 : Add some links with link module" (without any EOL nor special characters)
Object curro = current Object
string Text_Version = curro."Object Text"
const string str_anychar = "["charOf(1)"-"charOf(255)"]"
Regexp MyText = regexp2 "([A-Z a-z 0-9]*:)(str_anychar)*"
if (MyText Text_Version)
{
print Text_Version [match(0)] "\n"
print Text_Version [match(1)] "\n"
print Text_Version [match(2)] "\n"
}
// match [0] = "Version 2 :"
// match [1] = "Version 2 :"
// match [2] = ""
</pre>
Why match (0) and then match(2) are wrong ??
I expected match(0) = "Version 2 : Add some links with link module" and match(2) = "Add some links with link module" Even without EOL and with the const string, the regexp does not match !!!
Well, I tried your const string cl_re_strAnyChar but it doesn't work...
I've simplfied my object text.
<pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">// object text : "Version 2 : Add some links with link module" (without any EOL nor special characters)
Object curro = current Object
string Text_Version = curro."Object Text"
const string str_anychar = "["charOf(1)"-"charOf(255)"]"
Regexp MyText = regexp2 "([A-Z a-z 0-9]*:)(str_anychar)*"
if (MyText Text_Version)
{
print Text_Version [match(0)] "\n"
print Text_Version [match(1)] "\n"
print Text_Version [match(2)] "\n"
}
// match [0] = "Version 2 :"
// match [1] = "Version 2 :"
// match [2] = ""
</pre>
Why match (0) and then match(2) are wrong ??
I expected match(0) = "Version 2 : Add some links with link module" and match(2) = "Add some links with link module" Even without EOL and with the const string, the regexp does not match !!!
Beat my head against the wall yesterday and missed that. Doh!
However, I think you should move that last asterisk * inside the parens; this gives "match 2" the entire rest of the string. The way you have it, match 2 is just the last character, in this case "e".
DOORS is internally using UTF8, which has a much wider set of characters. The char type can hold much more than 255 different characters, but IBM never bothered to correct the "charOf", "intOf" functions.
So the easiest way for your specific regexp, is to remove the "anychar" part from the regex and simply take a substring after the "end 0" match. If you really need anychar, you need to resolve to something like
"[^" + (charOf 1) + "]"
(which assumes that you do not consider chr(1) as a valid character in your text. Hope this helps, Regards, Mathias
DOORS is internally using UTF8, which has a much wider set of characters. The char type can hold much more than 255 different characters, but IBM never bothered to correct the "charOf", "intOf" functions.
<pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">char c = addr_ 339
print c
c = charOf 339
print c
</pre>
So the easiest way for your specific regexp, is to remove the "anychar" part from the regex and simply take a substring after the "end 0" match. If you really need anychar, you need to resolve to something like