LangProc / langproc-2021-lab

2 stars 4 forks source link

Word within brackets, ending the word after the first sighting of a close bracket #56

Closed bakhtiarZ closed 2 years ago

bakhtiarZ commented 2 years ago

Hi,

This is an issue that pertains to test 19 and some others.

I want to make a regex that will capture words within brackets. I created: "[".*"]" , this worked for many test cases but it does not close the "Word" after the first close bracket sighting, for instance []]] will be read as []]] rather than [] <-word ]] <-- not in the rules.

I have also tried to do this : "["(^"]")*"]", logically i meant, anything in between the word within brackets excluding the ] symbol so that it would end at the next close brackets. But this began to ignore other characters such as [x[] .

I am not sure where to go from here, is there a way to represent this regex better? So that it will include any character within the brackets but end at the first close bracket

bakhtiarZ commented 2 years ago

I solved it,

the issue was that using (^x) doesnt work as the negated set, you must use square brackets.