parser – Python string parsing library support intelligent splitting of line while supporting single and double quotes


We have a program that will have a large string come in and which we want to split into each of it on whitespace. However we want to intelligently support single/double quotes to allow users to include a value with spaces as a single ‘argument’. In addition we would like to have the following:

  • A means of handling b”string” being converted to binary. That can be either the parser handling it directly or the parser being smart enough to know that b”string” should be split off with the quotes intact so that later logic can convert it.

  • Not break on | characters. They have special meaning so we would need to have a means to detect them so we can send stuff before and after the first non-quoted pipe to different logic

  • Ideally have some method of writing a windows directory without needing to have double backslashes everywhere, it’s fine if they need to be quoted.

  • Otherwise have a logically consistent feel to endusers. So supporting something like \t characters etc would be ideal.

There are allot of potential string parsing libraries available, I’m wondering which ones are likely to support all the above requirements easily?



Source link

Related Posts

About The Author

Add Comment