u/berne - 3 Archived Voat Posts in v/programming
u/berne
  • home
  • search

u/berne

0 posts · 3 comments · 3 total

Active in: v/programming (3)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: I suck at regex... Can someone please explain why only example C is working here?

Okay. I was just curious - because it looked so overly elaborate just for detecting letters. I figured you had a reason besides the utilitarian to use regexes and that the input char array was beyond your control or for "performance considerations".

There is an IsLetter(...) method in the Char class that can detect if a character is a Unicode 'letter' but that includes non-english letters. The simplest (a fastest) way to detect if a char is an english letter would be simply "if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) ...". This will not have any of the overhead that string conversions and regexes have and will also use the processor's cache and speculative execution efficiently - if that is ever a consideration.

Using regexes can be very efficient but mostly for complex syntaxes or longer 'strings'. Rolling your 'own' parser in such a case is likely a waste of time.

Good luck!

0 10 Aug 2019 10:21 u/berne in v/programming
Comment on: I suck at regex... Can someone please explain why only example C is working here?

So? What where you actually trying to do, and how did you solve it? :-)

0 09 Aug 2019 18:52 u/berne in v/programming
Comment on: For 40 years, computer scientists looked for a solution that doesnt exist

Finally! However, there are a couple of interesting approximating solutions, for instance: Polylogarithmic Approximation for Edit Distance and the Asymmetric Query Complexity

3 14 Aug 2015 00:07 u/berne in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.