MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.

As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.

x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Friday, October 28, 2022

VIm remains one of my most useful tools.

:v/pattern/d

From a somewhat useful SO comment:

Fwiw -- Looks like g [in a command like :g/pattern/d] is for "global" and v [like we have here] is for "inverse" (if you believe what you read on vim.famdom).

Labels: , ,


posted by ruffin at 10/28/2022 05:05:00 PM
Monday, January 25, 2021

It's kinda hard to see in the giant MDN Assertions Browser Compatibility Table, so here's why, if you still support IE or Safari at all, you don't get to use lookbehinds yet.

I'm not working with a transpiler right now [sic], but wonder if they're smart enough to parse regexes as part of the transpilation process. My guess would be no, but they should at least throw an error if you've got something your target doesn't support if they don't. Not going to check now, but I should. (note to self)


desktopDesktop

Chrome Edge Firefox Internet Explorer Opera Safari
lookbehind assertions ((?<= ) and (?<! ))

Labels: , , ,


posted by ruffin at 1/25/2021 10:08:00 AM
Friday, July 13, 2012

I was recently hoping Sublime Text's Vintage (vi-emulation) mode would allow me to do a search and replace over specified lines, one of my favorite time-savers from VIm. You know, something like...

:212,216 s/combobox/varTemp/g

No dice. I typed it, and SB2 stood there, looking at me. Dumbly, I might add.

But I thought I remembered it could do multiple cursors:
The shortยญcuts

To enable multi-selection, you have sevยญeral options:

* Press Ctrl + click (Mac is Cmd + click) in each region where you require a
cursor.
o this adds curยญsors wherยญever you click
* Select a block of lines and then press Shift + Comยญmand + L.
o adds curยญsors after your highยญlighted block
+ use the right arrow on keyยญboard to start typยญing after highยญlighted
block (and not erase what is highlighted)
* Place the curยญsor over a parยญticยญuยญlar word, and press Control/Command + D repeatedly
o to select addiยญtional occurยญrences of that word.
* Alt+F3 on Winยญdows, (or Ctrl+Command+G on the Mac)
o adds an addiยญtional curยญsor at all occurยญrences of a word by typยญing


Look, that's essentially regular expressions for dummies. It's really really cool. Don't get me wrong. And there are times I'll be using this instead of regexp. But, at the same time, I'll be learning a lot less about regexp doing things this way.

Oh, and it doesn't play especially nicely with Vintage's command mode.

Regardless, score 1 more for ST2.

Labels: , ,


posted by ruffin at 7/13/2012 04:09:00 PM
Wednesday, June 13, 2012

+, ?, |, {, }, (, and ) must be escaped to use their special function.


I love regex as a rule. I'm not as big a fan of individual implementations of its concepts. Couldn't figure out how to get X repetitions of a pattern while searching in VIm, and it's because { has to have a \ to work.

Who knew? Voodoo. What up with that?

So if I'm looking for table names over 30 characters in a text file (as Oracle doesn't like identifiers over 30 chars -- spits it out), the "right" regex is...

/[A-Z_]{30}

But for VIm it's:

/[A-Z_]\{30\}

(Yes, characters in the name must be caps or underscores)

Profit.

Labels: , ,


posted by ruffin at 6/13/2012 01:25:00 PM
Thursday, January 12, 2012

Now this is pretty cool, other than Javascript not supporting it... The RegEx Lookbehind. You can find a pattern and return hits only when it's not preceded by another pattern.

So I wanted to find where something was declared in a web/javascript app, not where it was instantiated by pulling it back by id. In this case, we're using the ExtJS framework (probably not my first choice, but a good, robust lib), so document.getElementById() or a jQuery $() is replaced by Ext.getCmp().

So I want to find any example of theObject that's not in the format...
Ext.getCmp("theObject")

Which is to say, I want to find any theObject not preceded by Ext.getCmp("

Here's the lookbehind-ige...
(?<!Ext\.getCmp\(")theObject

SHAZAM. That's neat.

And though it'll chew, JEdit will recursively Hypersearch that into a directory tree, no problems.

And then it'll clue me in that I need to say either " or ' in the regexp. Ooops.

(?<!Ext\.getCmp\(["|'])theObject

Cool.

Labels: ,


posted by ruffin at 1/12/2012 12:34:00 PM
Wednesday, December 10, 2008

It's really not that tough.

flock.com/[^b]

Voila. Now I get all the flock.com sans, say, "blogged" after it. HOW GREAT IS THAT?! Looks like that might be a relatively new addition to regexps, though, relatively speaking.

----------------
Now playing: Angelspit - Vena Cava

Labels:


posted by ruffin at 12/10/2008 11:09:00 PM

<< Older | Newer >>


Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (?_?), ยข, & ? if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.