embedme icon indicating copy to clipboard operation
embedme copied to clipboard

Allow regex parsing of files

Open koseduhemak opened this issue 5 years ago • 1 comments

Hi,

I got an idea for a new feature: Regex parsing which contents of a file should be extracted. As files tend to change, it would be very helpful to enhance the parser to allow something like: my-file.json#R:/"scripts".*\]/imgs which should match the following contents of my-file.json:

... other content here...
"scripts": [
    "scripts/general-env-variables.sh",
    "scripts/ca-certificates.sh",
    "scripts/apt-install.sh",
    "scripts/timezone-fix.sh",
    "scripts/python-pip-repository.sh",
    "scripts/cloudfoundry-cli.sh",
]
... other content here...

See here for example: https://regex101.com/r/URfVWn/1

This way we can extract in a more flexible / reliable way and do not need to adjust start and end of line if source files are changing...

What do you think?

Best wishes, koseduhemak

koseduhemak avatar Oct 27 '20 14:10 koseduhemak

So to clarify you're suggesting that an additional suffix be permitted that instead of defining which lines numbers to embed, it defines which lines matching an expression to embed?

I think this is a great idea, especially for data sources rather than code sources.

zakhenry avatar Nov 04 '20 08:11 zakhenry