On Friday 21 September 2007 09:44, Joe Smith wrote: > Mark Phillips wrote: > > I am using Dcount() to count the occurrences of some strings in a > > spreadsheet in OpenOffice Calc 2.0.3. I am using a regular expression to > > find the string I want. > > > > ... > > > > ... is there a way to modify my regular expression to handle this case. > > > > BTW, I tried using [:alpha:] instead of [a-zA-Z], and dcount() did not > > find any matches. Is [:alpha:] not working - it is listed in the > > documentation as a valid regular expression. > > I'm not sure I follow what it is you're trying to count--what a 'match' > should be. Sorry, - I hoped the example test cases were sufficient. Basically, each cell has a list of "terms", and I want to count how many of each one. 1. A term can be 1 or more words with spaces in between 2. If there are multiple terms in the cell, then each term has a single quote around it, and all the terms are enclosed in brackets "[" and "]". 3. If there is only one term in the cell, then there will only be the one term - no brackets or single quotes
> > If you just want to count cells that have the string "Board Member", then > > .*Board Member.* or .*'Board Member'.* Yup, that is what I am trying to do. You greatly simplified the solution - thanks! > > should be adequate. > > If there's something more complicated and you need to stay with your > current approach, try removing the single quotes from the character > classes. All that does is include the single quote as part of the class, > and I think that's where it fails in your example. > > \[[a-zA-Z, ]*'Board Member'(, )?[a-zA-Z]*(, )?\]|Board Member > > The named classes, e.g. [:alpha:] have some nasty problems. Usually they > can be tweaked to work, but sometimes not. Unless you anticipate needing to > scan non-Western text, they aren't particularly useful. Hmmm...wish that were documented somewhere. Thanks! > > If you're still stuck, post some verbatim examples of your data, and > indicate which ones should match and what portion of each should match, and > I'm sure we can find something that will work. Thanks, your solution is working! > > <Joe > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Phillips [EMAIL PROTECTED] 602 524-0376 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
