leerssej / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

No syntax error given for GREL startsWith(value,/\d.*/) #171

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to have startsWith(string s, sub or regex) supported instead 
of just startsWith(string s, sub).  Same for endsWith().

Interestingly, startsWith(value,/\d.*/) does not give a syntax error.

What is the expected output? What do you see instead?

Support regex subs or give a syntax error.

Original issue reported on code.google.com by thadguidry on 27 Oct 2010 at 6:41

GoogleCodeExporter commented 9 years ago
Isn't startsWith and endsWith redundant for a regex?  Those things can be 
specified in the expression itself.

The advantage to startsWith and endsWith is that they're simple and I think it 
would be good to keep them that way.

Original comment by tfmorris on 27 Oct 2010 at 7:56

GoogleCodeExporter commented 9 years ago
Yes, it is kind of redundant, I know. Thoughts further...

How do I perform a pattern match within arrayed sets using something like 
value.match(/.*(\d\d\d+)/) that either provides a facet with True or False, or 
can be pipelined into a function that provides this boolean ? That function 
returns just a [] for me when it matches unfortunately, and my facet remains 
blank as well.  In other words, pulling out a specific pattern from my arrays 
where the pattern may appear at the beginning, or end, or somewhere in the 
middle of my string ?  Tricky stuff for me here, so I'm learning. I added sort 
of what I'm trying to do with 'Find a sub pattern that exists' in the Quick 
Recipes http://code.google.com/p/google-refine/wiki/Recipes Anyone ?

Original comment by thadguidry on 27 Oct 2010 at 8:45

GoogleCodeExporter commented 9 years ago
Even more simplified question, in case I threw off everyone in that last 
comment.

The following expression is returning true for everything even when I have 
blank cells. Here, I'm just trying to see if the word SUITE appears anywhere in 
the string.  Yes, we have contains(), I know.  But sometimes I want to really 
flex some muscles with regex.

not(value.match(/.*SUITE.*/))

Original comment by thadguidry on 27 Oct 2010 at 8:58

GoogleCodeExporter commented 9 years ago
I agree having the option of using regex in contains, startsWith and endsWith 
would be really helpful, since match does not return boolean. 

Original comment by jluci...@gmail.com on 12 Jan 2011 at 7:25

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 7 Jun 2011 at 5:57