Wednesday, August 24, 2011

Lookbehind/Lookahead Assertion with Npp Regex

Today I was looking for a way to get the last character of a pattern so that I could replace it. In this example, I wanted to find the last pipe in a record like 8|34346|. Normally with regex, one could do this using a lookbehind assertion. To do this with notepad++ you must utilize the implicit search buffer, by using a \1 in the replace field (for example, to access the first set in the buffer).

So by searching on: 1|10007||lastname,first name|X

"Find What:" ([0-9]*[|][0-9]*)[|]
"Replace With:" \1%

I could get: 1||lastname,first name|X


Wednesday, August 3, 2011

Lay Interpretation of Cancer Incidence

Cancer is a big deal, and the potential environmental factors make mapping incidence very appealing. This has made maps a handy device for newspapers and other "lay" interpretations, which typically don't employee rigorous statistical tests for significance. Victor Perez, a researcher at UD wants to investigate the ways cancer incidence is discussed in these lay publications. As a discursive preliminary step in this study, Dr. Perez asked me to help him prepare a map that would show what a random incidence of cancer cases might look like. To do this I used the "generate random points" tool using data on census tracts (Total Population from Census 2000) and given average Delaware cancer incidence.