Create custom-collections from txt file [v1.3, final]
-
-
@meleu @pjft
I updated previous post to give tributes.
Well I think there are other characters that can be included. But I think space and "-" and () are good way.
The underscore works btw ;)
What do you both think.... Is v1.3 with RegEx^[][()\ \'A-Za-z0-9-]+$
final? or should it be extended. For my personal usage it's enoughWe can add
\_
and then the underscore works, what's next? #,&,!,?,~..... -
@cyperghost No, please stay away from most of the characters you just mentioned, as some of them are special characters in different file systems (~, ?, etc).
I'd rather keep the REGEXP exactly the same for compatibility purposes. I don't like to give people tools for them to easily shoot themselves in the foot :)
-
Okay... I update script (hopefully last time) and add the underscore.
-
@cyperghost said in Create custom-collections from txt file [v1.3, final]:
We can add _and then the underscore works
There's no need to scape underscore. Then the regex is
^[][()\ \'_A-Za-z0-9-]+$
-
Hi
Really nice idea ! Thanks
Suggestion :
Instead of using if/else, just sanitize the string with the regex used in the if:
sline=${$line//^[][()\ '_A-Za-z0-9-]/} -
@meleu updated
Can we discuss the RegEx things on the bash script thread?
It's a very powerfull feature indeed ;)@w0lv3r1nix
Well that's also a suggestions there a many ways to skin a cat ;)
As I'm still learning I'm thankfull for every little bash lesson.
But I think the if/else clause is easier for code readings and beginners like me.
See if you stumple after years on your piece of code.... you would ask... what was my intentions there.With
if
you have a expression with a clear result ... noif
withoutthen
and maybe anelse
>> good result ;) -
@cyperghost said in Create custom-collections from txt file [v1.3, final]:
Can we discuss the RegEx things on the bash script thread?
Sure. Go ahead. :-)
-
@cyperghost said in Create custom-collections from txt file [v1.3, final]:
TRIM CR from windows files
Just a small (bad) joke:
-
@meleu We just trim CR ;)
No need for getting mad ... But well we live in WINDOWS world ;)Sorry mate - I'm currently hard working :(
So no time for asking bash ;)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.