<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68520>68520</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Is the behavior for llvm::Regex expected?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lcvon007
</td>
</tr>
</table>
<pre>
```
#include "llvm/Support/Regex.h"
#include "llvm/ADT/StringRef.h"
#include <string>
#include <iostream>
using namespace std;
int main() {
string s("abs");
llvm::StringRef reg(s);
llvm::Regex r(reg);
cout << (r.match("hal_abs") ? "match" : "not match" ) << endl;
return 0;
}
```
It will output "match", and
```
#include <regex>
#include <string>
#include <iostream>
using namespace std;
int main() {
std::string str="abs";
std::regex r(str);
cout << (regex_match("hal_abs", r) ? "matched" : "not match") << endl;
return 0;
}
```
It will output not match.
Is it expected that the behavior is different between llvm and std?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8lM9u4zgMxp-GvhAbKFT87-BDmqyBXrt7L2SbsbVQZEOS2-7bD-SkzgRt5jCHAXKIxY_kJ_5sKu91b5krSJ8gPSZqDsPoKtO-jVaIPGnG7v8KMnH9iSOIPZDUtjVzxwhExrydgep_5mkaXQCqX7jnj80ARL-Q74__xqTgtO1f-PRALg9-UYD8-7ugHn1wrM5rePba9mjVmf2kWkYfOpBPl5i2Ac9KW6ACqETIr-d4aYF-CZBqfLRC5ZqIuHiWe5D71TA67oEK_0i4DAEdULEIfxK14xyieZAHjOHNWYV2uDQflHldDSDIOk7sGicEuY_PdowX-TxbdEsxtp25tXEcZmdRrCeQH69_7mk-B3zXxuA4hyk6uzUEOqCy3bdZ9yBcvO0DSH-AIOJFFwf_STM4kMcbT_md1q2QovyOJH7hFLWvD1gdYpF7YNw9QPaQGOJvQ1vrb67qi8ijDsgfE7eBOwyDChgGxoYH9aZHh9pjp08ndmwDNhzeme3yDkfslzHVmHSV7EpZqoSrbVZmeUZymyVD1Z7aPG8zKhrO87bYCSqLU1qmVKSCslwluiJBcitEsRXpNs02JJudypTqVNny9lTATvBZabOJPTej6xPt_cxVVqQkEqMaNn5ZTESW33EJxgmmx8RVMeevZu497ITRPvhblaCD4erZ39_2NLovH-jncEDWyexMNYQw-SigGqjudRjmZtOOcWNdF9fSdnLjf9zGZbd48kD14vlHAAAA__9DcYlg">