Regular expressions in rules

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Regular expressions in rules

Nick Hall-6
A user on the gramps-users list has asked for the HasPlace rule to
support regular expressions.

6599: Allow selection of empty or null values in Custom Filters for
Places matching parameters

The filter sidebar uses code in the Rule class to implement regex
matching.  The rule is instantiated with use_regex set to True when the
"Use regular expressions" option is selected.

Custom filters don't give an option to use this facility.  There are a
few filters which do allow regular expressions though.  These are rules
for matching names of people, Gramps IDs and objects with notes.

Some rules, including the rule for matching places, do not give an
option for matching on regular expressions in the rule editor.

Perhaps we should give an option to use regular expressions for all
rules where it is applicable?

Nick.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

derHeinzi
On Fri, 05 Apr 2013 20:45:37 +0200, Nick Hall <[hidden email]> wrote:

> A user on the gramps-users list has asked for the HasPlace rule to
> support regular expressions.
...
> Some rules, including the rule for matching places, do not give an
> option for matching on regular expressions in the rule editor.
>
> Perhaps we should give an option to use regular expressions for all
> rules where it is applicable?

Nick, that would be great. Especially for all names fields.
By coincidence I tried to filter for all people having assigned a callname today. I was not able to find or create a working rule for this in 3.2.5-1. Is it possible with current rules?

Kind regards,
Heinz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

Nick Hall-6
On 05/04/13 20:48, Heinz Brinker wrote:

> On Fri, 05 Apr 2013 20:45:37 +0200, Nick Hall <[hidden email]> wrote:
>
>> A user on the gramps-users list has asked for the HasPlace rule to
>> support regular expressions.
> ...
>> Some rules, including the rule for matching places, do not give an
>> option for matching on regular expressions in the rule editor.
>>
>> Perhaps we should give an option to use regular expressions for all
>> rules where it is applicable?
> Nick, that would be great. Especially for all names fields.
> By coincidence I tried to filter for all people having assigned a callname today. I was not able to find or create a working rule for this in 3.2.5-1. Is it possible with current rules?

I don't know about v3.2, but in v3.4 the "People with the <name>" allows
regular expressions.

Nick.

>
> Kind regards,
> Heinz
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

derHeinzi
On Fri, 05 Apr 2013 22:08:04 +0200, Nick Hall <[hidden email]> wrote:

Hi Nick,

> I don't know about v3.2, but in v3.4 the "People with the <name>" allows
> regular expressions.

Comparing the docs between 3.2 and 3.4 suggests the same. Time for an update.
Thank you.

Heinz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

Nick Hall-6
In reply to this post by Nick Hall-6
Looking at this further, we are not consistent in the way we handle
regular expressions in rules.

Some rules have two versions:  one for substring matching and another
for regular expressions.  Others have a "Use regular expressions" option
in their value list.

Some rules use the match_substring method in the base class, whilst
others use their own code.

I suggest the following:

1. Rules should use the code to handle regular expressions in the base
class.
2. Add a use_regex attribute to the rule tag in the xml.
3. Add a "Use regular expressions" option to the Rule Editor for
applicable rules.
4. Deprecate regular expression rules in favour of substring rules with
a regular expression option.

What do you think?

I have a patch for v3.4 that is quite simple and works well.

Nick.


On 05/04/13 19:45, Nick Hall wrote:

> A user on the gramps-users list has asked for the HasPlace rule to
> support regular expressions.
>
> 6599: Allow selection of empty or null values in Custom Filters for
> Places matching parameters
>
> The filter sidebar uses code in the Rule class to implement regex
> matching.  The rule is instantiated with use_regex set to True when the
> "Use regular expressions" option is selected.
>
> Custom filters don't give an option to use this facility.  There are a
> few filters which do allow regular expressions though.  These are rules
> for matching names of people, Gramps IDs and objects with notes.
>
> Some rules, including the rule for matching places, do not give an
> option for matching on regular expressions in the rule editor.
>
> Perhaps we should give an option to use regular expressions for all
> rules where it is applicable?
>
> Nick.
>
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

Doug
In reply to this post by Nick Hall-6
On 05/04/13 20:45, Nick Hall wrote:

> A user on the gramps-users list has asked for the HasPlace rule to
> support regular expressions.
>
> 6599: Allow selection of empty or null values in Custom Filters for
> Places matching parameters
>
> The filter sidebar uses code in the Rule class to implement regex
> matching.  The rule is instantiated with use_regex set to True when the
> "Use regular expressions" option is selected.
>
> Custom filters don't give an option to use this facility.  There are a
> few filters which do allow regular expressions though.  These are rules
> for matching names of people, Gramps IDs and objects with notes.
>
> Some rules, including the rule for matching places, do not give an
> option for matching on regular expressions in the rule editor.
>
> Perhaps we should give an option to use regular expressions for all
> rules where it is applicable?
>
> Nick.
>

+1.

I've encountered lots of non-obvious places where a
functioning regex would have been a boon. Some time ago
there was a feature request to extend its availability and I
believe Doug Blank thought it should be made more general.

Doug

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Regular expressions in rules

Benny Malengier
In reply to this post by Nick Hall-6
Ok,

As long as for the normal person not knowing regular expressions, they can still work easily.

As a plus, for regular expression field, perhaps add a tooltip with most easy examples, like search on "J[oa]nes", ... so as to give common users some idea of the power by looking at the tooltip.

Benny


2013/4/6 Nick Hall <[hidden email]>
Looking at this further, we are not consistent in the way we handle
regular expressions in rules.

Some rules have two versions:  one for substring matching and another
for regular expressions.  Others have a "Use regular expressions" option
in their value list.

Some rules use the match_substring method in the base class, whilst
others use their own code.

I suggest the following:

1. Rules should use the code to handle regular expressions in the base
class.
2. Add a use_regex attribute to the rule tag in the xml.
3. Add a "Use regular expressions" option to the Rule Editor for
applicable rules.
4. Deprecate regular expression rules in favour of substring rules with
a regular expression option.

What do you think?

I have a patch for v3.4 that is quite simple and works well.

Nick.


On 05/04/13 19:45, Nick Hall wrote:
> A user on the gramps-users list has asked for the HasPlace rule to
> support regular expressions.
>
> 6599: Allow selection of empty or null values in Custom Filters for
> Places matching parameters
>
> The filter sidebar uses code in the Rule class to implement regex
> matching.  The rule is instantiated with use_regex set to True when the
> "Use regular expressions" option is selected.
>
> Custom filters don't give an option to use this facility.  There are a
> few filters which do allow regular expressions though.  These are rules
> for matching names of people, Gramps IDs and objects with notes.
>
> Some rules, including the rule for matching places, do not give an
> option for matching on regular expressions in the rule editor.
>
> Perhaps we should give an option to use regular expressions for all
> rules where it is applicable?
>
> Nick.
>
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel