Re: Looping regexes against a list

2015-01-19 Thread Danny Spell
For me, regex can be simple or complex. It depends on the task at hand. The more complex the task, the more complex the regex. My boss who can code, but doesn't want to, *HATES* regex. Personally, I think it is pretty powerful and I'm grateful for its flexibility. I use it daily in my job where s

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:43:41 -0500 John Mason wrote: > On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey > wrote: > > > On Mon, 19 Jan 2015 11:18:01 -0500 > > bill pemberton wrote: > > > > > I fail to see why a regex can only be changed by a programmer. > > > please expand upon this. > > > > You

Re: Looping regexes against a list

2015-01-19 Thread John Mason
On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey wrote: > On Mon, 19 Jan 2015 11:18:01 -0500 > bill pemberton wrote: > > > I fail to see why a regex can only be changed by a programmer. please > > expand upon this. > > You shouldn't blindly trust input from a user, there should be checking/limit

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:18:01 -0500 bill pemberton wrote: > I fail to see why a regex can only be changed by a programmer. please > expand upon this. Regex is a programming language in its own right. Why should an average user have any knowledge of it? -- Don't stop where the ink does.

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 15:57:35 + Andrew Solomon wrote: > On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin > wrote: > > The lookup hash is like this > > %clean=( > > HeatingEngineer => (?:Heating.*?Engineer)\b.*? > > HGV > > Driver=>(?=\A(?:(?!tech|mech).)*$)(?:HGV|LGV|Class.?1|Class.?2).?(?

Re: Looping regexes against a list

2015-01-19 Thread Andrew Solomon
First question which comes to mind is - do you really need to call sort in those two foreach collections? Sort can often take time, and the fact that you've got one sort nested inside a foreach loop is bad karma:) Andrew On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin wrote: > The lookup hash is li

Re: Looping regexes against a list

2015-01-19 Thread Mike Martin
The lookup hash is like this %clean=( HeatingEngineer => (?:Heating.*?Engineer)\b.*? HGV Driver=>(?=\A(?:(?!tech|mech).)*$)(?:HGV|LGV|Class.?1|Class.?2).?(?:1|2|3|)(?:.+Driver|).*? HGV Mechanic=> (?:(?:HGV|LGV|Lorry).+(?:Mech?anics?|technicians?))\b.*? Highway Engineer=> (?:(?:Highway.?) (?:En

Re: Looping regexes against a list

2015-01-19 Thread Brandon McCaig
Mike: On Mon, Jan 19, 2015 at 01:25:56PM +, Mike Martin wrote: > Hi Hello, > I am looking for the most performant way to achieve this > > I have a big list of text (47+ lines in a hash) I then run > a hash ref consisting of replacement text - pattern to search - > optional 3rd param for

Looping regexes against a list

2015-01-19 Thread Mike Martin
Hi I am looking for the most performant way to achieve this I have a big list of text (47+ lines in a hash) I then run a hash ref consisting of replacement text - pattern to search - optional 3rd param for grouping matches So I loop through the text and then loop the regex hash against each r