Is there any other way than .match("")
, to specify that my String may as well contain an empty String alongside with some other stuff?
So far my regexp looks like this:
s = /(?<beginString>[\sA-Za-z\.]*)(?<marker1>[\*\_]+)(?<word>[\sA-Za-z]+)(?<marker2>[\*\_]+)(?<restString>[\sA-Za-z\*\_\.]*)/ =~ myString
now I want to assign beginString an empty String, because the program runs recursively. I want to be able to pass this function a String like "*this* _is_ ***a*** _string_"
so as you can see, there is plenty possibility that beginString has to be empty in order that it reads the next marker.
In the end I want my program to print this:
{"01"=>#<Textemph @content="this ">, "02"=>#<Textemph @content="is">,
"11"=>#<Textstrongemph @content="a">, "12"=>#<Textemph @content="string">}
I think that it might fix my problem if I could just put somthing like \nil
up there in the [ ].
Please just tell me how to add .match("")
but in //
-form.
Thank you for your Help <3