0

Hello this is my string

Data1 = "value1";
Data2 = "value2";
Data3 = "value3";

in php i am using this regex

preg_match("/\h*(.*?)\h*[=]\h*[\"](.*?)[\"]\h*[;]/mis", $input_line, $output_array);

and get 3 result

Data1 = "value1";
Data1
Value1
...
...

now i want to use regex in c++ visual studio to do like this (what i done in php). i know we can't find

\h*

in c++ regex so please say to me what regex i must use for c++?

2
  • 1
    I don't know c++ but you could try the plain space character with the *, or for tabs too possible [ \t]*. See regex101.com/r/zI8vS3/2 and regex101.com/r/zI8vS3/1 Commented Feb 20, 2016 at 15:16
  • 1
    [[:blank:]]* should be what you are looking for. You can also add your own shorthands with regex_traits if you want to define \h yourself. Commented Feb 20, 2016 at 15:26

1 Answer 1

1

\h matches horizontal whitespace.
It includes tabulations and unicode spaces. It's the same as [\t\p{Zs}]

If you don't want to match all unicode spaces, you can simply use [\t ] that matches tabulations and simple spaces.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.