Parsing a string with "boundaries"
See original GitHub issueHello.
I have had trouble coming up with a grammar for parsing a string that has a specific char at its “boundaries” in a greater path-like structure but which may also contain the boundary char internally.
So if the boundary char is * I need to pick out *foobar* in e.g. /foo/*foobar*/bar. My problem is that the *foobar* string may also contain the “boundary char” e.g. *foo*bar* so I cant use a negative char range for the parsing of the token between the /s.
Is it possible to do this with a PEG? And apologies if this is not the place for questions like this.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Split on word boundaries. : String split « Data Type « Java
Use split() to extract substrings from a string. Split same string on commas and zero or more spaces. Split on word boundaries, but...
Read more >Regex Boundaries and Delimiters—Standard and Advanced
Anchors assert that the current position in the string matches a certain position: the beginning, the end, or in the case of \G...
Read more >Divide strings using String.Split (C# Guide) - Microsoft Learn
This method is often the easiest way to separate a string on word boundaries. It's also used to split strings on other specific...
Read more >stri_split_boundaries: Split a String at Text Boundaries in stringi
This function locates text boundaries (like character, word, line, or sentence boundaries) and splits strings at the indicated positions. Usage.
Read more >Splitting by word boundaries including apostrophes
I want to split each word of a string including spaces and punctuations in different groups, but I want to keep words with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Great! Thanks a lot for your help, @Mingun and @hildjj - it is much appreciated.
Taking mingun’s grammar as a start, I came up with this, which gets all of the edge cases I could think of: