How to use verbatin String in managed c++

checkingrandom 206 Reputation points
2023-01-03T08:12:34.25+00:00

I'm working with c# regex and got the expected result

var match = Regex.Match(sub, @"\w{5}-\w{5}-\w{5}-\w{5}-\w{5}");

So now I'm working with the same code with managed c++, now Im getting error in Regex.Match().

Match m = Regex::Match(number[i], "\w{5} - \w{5} - \w{5} - \w{5} - \w{5}");

but I'm getting the following error "no suitable user-defined conversion from "System::Text::RegularExpressions::Match ^" to "System::Text::RegularExpressions::Match" exists"

I also used raw string for the regex pattern, still the issue is resolved

Match m = Regex::Match(number[i], R"~(\w{5} - \w{5} - \w{5} - \w{5} - \w{5})~");

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,294 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,541 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful