Are people seriously still deliberately using ASCII-reliant code?
Every time I've had to deal with Unicode and internationalization, it's been a problem. For example, a few years ago I grabbed a source tarball from somewhere, I forget what or where. It had the author's name in a comment, which included an O with dots over it. That was the only non-ASCII character in the source code. No matter what I did, both Eclipse and command-line javac refused to compile the source. Finally I w…
My favorite regex of all time
111–117 of 117 posts
Re: My favorite regex of all time
#112Earlier quoted context omitted.
If a regex is going to be reusable, then yeah, I'd agree. But dumping single lines of code into their own functions just for readability isn't practical for real time systems. In those cases you really should be using comments as they get stripped out by the compiler.
REGEXES aren't practical for real time systems. If you're using a regex, and certainly if you're using a language other than C, you probably have space for the function call overhead.
Sometimes C is inappropriate (eg you'd be nuts to build a website in C yet some sites do offer real time services)
Often the data set and/or logic required makes C an inappropriate language (eg you wouldn't use C for AI nor for some types of database operations).
And even in the cases where you're just building a standard procedural system, sometimes the interface lends itself better to other languages (eg C would be possibly the worst language for real time websites.)
But even in the cases where you're building a solution that's suited for C, there are still other performance languages which could be used.
"Real time" is quite a general term and as such, sometimes it makes more sense to use scripting languages which are performance tuned. Which is where writing 'good' PCRE is critical as RegEx can be optimised and compiled - if you understand the quirks of the language well enough to avoid easy pitfalls, eg s/^\s//; s/\s$//; outperforms s/(^\s|\s$)//; despite it being two separate queries as opposed to one.
Re: My favorite regex of all time
#113Earlier quoted context omitted.
REGEXES aren't practical for real time systems. If you're using a regex, and certainly if you're using a language other than C, you probably have space for the function call overhead.
I don't really agree with that. Sometimes C is inappropriate (eg you'd be nuts to build a website in C yet some sites do offer real time services) Often the data set and/or logic required makes C an inappropriate language (eg you wouldn't use C for AI nor for some types of database operations). And even in the cases where you're just building a standard procedural system, sometimes the interface lends itself better t…
If you're in a situation where the overhead of a couple of function calls is unacceptable, regexes are totally unacceptable and you need to write custom character manipulation.
This situation is really rare and in almost all business cases, using C is inappropriate.
Re: My favorite regex of all time
#114Earlier quoted context omitted.
It's not an ASCII v EBCDIC thing, its an ASCII vs Unicode thing.
More generally, it's a characterset / collate sequence thing. Specifying a range with a start and end point requires understanding what that range specifies. Which can change depending on context, locale, characterset, etc.
Re: My favorite regex of all time
#115Re: My favorite regex of all time
#116Earlier quoted context omitted.
It's not just Unicode either. I just mentioned EBCDIC because that particular regex has bit me before when I was translating perl scripts from Linux to zOS USS. Take a look at the code page for EBCDIC, you'll see quickly why it's a massive pain to sort through regexes like that.
I honestly thought you were being sarcastic. I've never heard of someone who has actually used EBCDIC.
Re: My favorite regex of all time
#117Earlier quoted context omitted.
More generally, it's a characterset / collate sequence thing. Specifying a range with a start and end point requires understanding what that range specifies. Which can change depending on context, locale, characterset, etc.
Also in the 32-127 ASCII range? I thought they just differ in 128-255 with the code pages and such?
Makes sorts really tweaky.