Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The regex I prepared for php (I don't know if there is a different build in c ++)  on https://regex101.com/: 

    (?<=deneme\()([^]]+)(?=\))

Target string:

    deneme("deneme", 1,2,deneme2(), 3, "3123", sda())

Expected output:
   
    "deneme", 1,2,deneme2(), 3, "3123", sda()

I can't give an example code because I don't know anything about regex in c ++. How can I get the expected output on c ++ based on the examples I gave above?


this code works in c # and gives the output I want. I don't know how to convert it to c ++.

```cs
using System;
using System.Text.RegularExpressions;

public class Example
{
    public static void Main()
    {
        string pattern = @"(?<=deneme\()([^]]+)(?=\))";
        string input = @"deneme(""deneme"", 1,2,deneme2(), 3, ""3123"", sda())";
        RegexOptions options = RegexOptions.Multiline;
        
        foreach (Match m in Regex.Matches(input, pattern, options))
        {
            Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
        }
    }
}
```

I can also write a related code with php. but I am also confused in c ++.
```php
$re = '/(?<=deneme\()([^]]+)(?=\))/m';
$str = 'deneme("deneme", 1,2,deneme2(), 3, "3123", sda())';

preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);

// Print the entire match result
var_dump($matches);
```


What I have tried:

I haven't had experience as I don't have enough knowledge of std :: regex to dump what I want into c ++ code.
Posted
Updated 6-Dec-20 23:32pm

1 solution

 
Share this answer
 
v2
Comments
Maciej Los 7-Dec-20 6:50am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900