Re: [users] OR and AND in regular expressions

2008-04-15 Thread Régis POTELLE
Thank you again for your help. But I think I can fix my problem without AND
for the moment, after all. I'll remember your trick, however

kindest regards


2008/4/13, Harold Fuchs [EMAIL PROTECTED]:

 On 12/04/2008 17:31, Régis POTELLE wrote:

  Thank you for your quick answer. Using OR as you tell me may be
  helpfull.
  For the AND, I'll see later
 
  kindest regards
 
 
 
 
 In fact I just thought of a way to do AND but the solution is based on a
 facility in Writer which may or may not exist in other word processors. As
 an example, assume you want to find lines containing a and b and c but
 in any order:
 1. Find, using Regular Expressions, .*a.*. Use Find All. This will
 highlight all the lines containing an a.
 2. Select Currently selection only and Find All .*b.*. This will leave
 highlighted all the lines containing a and b in either order.
 3. Keep Current selection only ticked (checked) and Find All .*c.*.
 Done. Only lines with a and b and c, in any order, will remain
 highlighted.

 The problem with this method is that, while it will find abc or bac
  or bca or ..., it will also find aqwercghjkb which has an a, a b
 and a c within it. This may not be what you want ...

 The RE .*a.* means any number of any character followed by an a
 followed by any number of any character. Here any number includes zero. Of
 course the a being found can be replaced by any string/RE.

 snip


 --
 Harold Fuchs
 London, England
 Please reply *only* to users@openoffice.org





Re: [users] OR and AND in regular expressions

2008-04-13 Thread Régis POTELLE
Thank you for your quick answer. Using OR as you tell me may be helpfull.
For the AND, I'll see later

kindest regards

2008/4/12, Harold Fuchs [EMAIL PROTECTED]:

 On 11/04/2008 18:14, Régis POTELLE wrote:

  Dear Sir, Madam,
 
  Openoffice is for me an essential tool . I'm using it every day within
  the
  context of my work, especially the macro-programming . Hats off to you
  for
  this software !
 
  My question is the one after:
 
  Is it possible to use boolean expressions like AND or OR in regular
  expressions ? And if so, how shall I do it ?
 
 
 The or is represented by a vertical bar. So a|b means a or b and
 (ab)|(cde)|(xy*) means ab or cde or an x followed by zero or more y's.
 For single characters you can also say things like [aeiouy] meaning a or
 e or i or o or u or y or [a-z] meaning any unaccented lower case
 letter.

 The and, when sequence is immaterial, is much harder if not impossible
 :-( So abc means a and b and c but *in that sequence*. If you want to
 say a and b and c in any sequence then I don't know how to do it. Of
 course, if there are only a few possibilities then you could or all the
 possible permutations ; (abc)|(acb)|(bac)|(bca)|(cab)|(cba) but that's not
 practical in the general case. I don't think even perl (the doyen of REs)
 can do this.

 Please note that I'm using OOo 2.4. I'm not sure if the vertical bar is
 available in previous versions.

  I thank you in advance
 
  Kindest regards
 
  P.S: excuse my poor English: I'm a french man...
 
 
 

 Your English is much better than my French ...

 --
 Harold Fuchs
 London, England
 Please reply *only* to users@openoffice.org





Re: [users] OR and AND in regular expressions

2008-04-13 Thread Harold Fuchs

On 12/04/2008 17:31, Régis POTELLE wrote:

Thank you for your quick answer. Using OR as you tell me may be helpfull.
For the AND, I'll see later

kindest regards


  
In fact I just thought of a way to do AND but the solution is based on 
a facility in Writer which may or may not exist in other word 
processors. As an example, assume you want to find lines containing a 
and b and c but in any order:
1. Find, using Regular Expressions, .*a.*. Use Find All. This will 
highlight all the lines containing an a.
2. Select Currently selection only and Find All .*b.*. This will 
leave highlighted all the lines containing a and b in either order.
3. Keep Current selection only ticked (checked) and Find All .*c.*. 
Done. Only lines with a and b and c, in any order, will remain 
highlighted.


The problem with this method is that, while it will find abc or bac  
or bca or ..., it will also find aqwercghjkb which has an a, a b 
and a c within it. This may not be what you want ...


The RE .*a.* means any number of any character followed by an a 
followed by any number of any character. Here any number includes 
zero. Of course the a being found can be replaced by any string/RE.


snip


--
Harold Fuchs
London, England
Please reply *only* to users@openoffice.org



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[users] OR and AND in regular expressions

2008-04-11 Thread Régis POTELLE
Dear Sir, Madam,

Openoffice is for me an essential tool . I'm using it every day within the
context of my work, especially the macro-programming . Hats off to you for
this software !

My question is the one after:

Is it possible to use boolean expressions like AND or OR in regular
expressions ? And if so, how shall I do it ?

I thank you in advance

Kindest regards

P.S: excuse my poor English: I'm a french man...


Re: [users] OR and AND in regular expressions

2008-04-11 Thread Harold Fuchs

On 11/04/2008 18:14, Régis POTELLE wrote:

Dear Sir, Madam,

Openoffice is for me an essential tool . I'm using it every day within the
context of my work, especially the macro-programming . Hats off to you for
this software !

My question is the one after:

Is it possible to use boolean expressions like AND or OR in regular
expressions ? And if so, how shall I do it ?
  
The or is represented by a vertical bar. So a|b means a or b and 
(ab)|(cde)|(xy*) means ab or cde or an x followed by zero or more 
y's. For single characters you can also say things like [aeiouy] 
meaning a or e or i or o or u or y or [a-z] meaning any unaccented 
lower case letter.


The and, when sequence is immaterial, is much harder if not impossible 
:-( So abc means a and b and c but *in that sequence*. If you want 
to say a and b and c in any sequence then I don't know how to do it. 
Of course, if there are only a few possibilities then you could or all 
the possible permutations ; (abc)|(acb)|(bac)|(bca)|(cab)|(cba) but 
that's not practical in the general case. I don't think even perl (the 
doyen of REs) can do this.


Please note that I'm using OOo 2.4. I'm not sure if the vertical bar is 
available in previous versions.

I thank you in advance

Kindest regards

P.S: excuse my poor English: I'm a french man...

  


Your English is much better than my French ...

--
Harold Fuchs
London, England
Please reply *only* to users@openoffice.org



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[users] Re: Some difficulty with regular expressions

2007-03-14 Thread ben


- Original Message - 
From: Richard Detwiler [EMAIL PROTECTED]
I had some trouble getting certain regular expressions to work. Here's an 
example, taken from Help:

[:space:]   Represents a white space character such as space.
When I try this, I get the message that the search key was not found, even 
though there are lots of spaces in the document I was searching.


Hello Richard,

A while ago -- in early February, I think -- there was some activity in 
this mailing list regarding searches that involve specs such as [:xxx:], 
e.g. [:digit:] or [:space:]. As was then pointed out, useful information 
about regular expressions can be found in an article by Garry Knight:

http://homepage.ntlworld.com/garryknight/linux/ooregexp.html
My contribution to that discussion was along the lines of what is stated 
below. I think you will find that it takes care of your problem.


Ben Winter

- - - - -

A specification like [:xxx:] is used when searching for a _string_ of
objects of a certain type. The part that replaces xxx specifies the _type_
of object one is looking for
(e.g., replacing xxx by  digit  specifies a decimal digit). By itself, a
specification like[:xxx:] is incomplete; one must also state the _length of
string_ (and that can be done with ? , + , or {k}). Thus
search for  [:digit:]?  finds the next decimal digit (string of digits, of 
length 1)
search for  [:digit:]+  finds the next string of decimal digits (of any 
length)

search for  [:digit:]{2}  finds the next string of 2 decimal digits etc

Likewise for [:space:]?, [:space:]+, [:space:]{2} and other such searches. 
Apparently [aBc] (without colons) states specific, concrete objects to be 
matched, whereas [:xxx:] (with colons) refers to an abstract type. To get a 
searchable object, you need to add something to [:xxx:] to make it concrete; 
e.g.,
state a length-specification to move from the abstraction _digits_ to 
something concrete like 'string of 3 digits'.


However, by my interpretation, a[:digit:]b should not yield any hits - but 
it does.





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[users] Issuezilla: Any documentation on regular expressions?

2006-11-29 Thread Joe Smith

In Issuezilla (http://qa.openoffice.org/issues/query.cgi):

I would like to search for issues related to tab stops. If I search for 
'tab' as a word/string, I get a gazillion hits that deal with 'table's. 
I would like to specify that 'tab' must appear as a word by itself, 
however neither of the regular expression syntaxes I am familiar with ( 
\tab\ or \btab\b ) do this.


A boolean search for 'tab' NOT 'table' is not the same.

So, 1) does anyone have any other suggestions[*] for limiting the search 
to a word (not a substring), and 2) does anyone know where the regular 
expression syntax supported in Issuezilla is documented?


[*] Using 'tab[ ]' helps but may miss something, e.g. if the field ends 
with 'tab'.


Joe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-07-03 Thread Uwe Fischer

Hi,

the issue is http://www.openoffice.org/issues/show_bug.cgi?id=64368 as 
Niklas posted. And thank you, kevin, for the very good explanation of 
atoms and quantifiers in regular expressions.



Uwe

Andrew Douglas Pitonyak wrote:

An issue already exists for this... :-)

Donald H Locker wrote:

I just tested in 2.0.2 and it is definitely broken.  [:space:] does 
not match anything by itself, whereas it should match the character 
class of whitespaces, as I read it should in the helpfile, and as such 
a construct would behave in other RE engines.  Ditto [:digit:], which 
doesn't match anything, while it should match [0-9] by my reading.


kevin johnston wrote:

In a Regular Expression search, if [:space:] and [:digit:] only work 
with + or * or {}, it's a bug.


[:space:] by itself, all alone, should recognize exactly one white 
character.



[snip]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--
  [EMAIL PROTECTED]  -  Technical Writer
  StarOffice - Sun Microsystems, Inc. - Hamburg, Germany
  http://www.sun.com/staroffice
  http://documentation.openoffice.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-07-01 Thread kevin johnston
In a Regular Expression search, if [:space:] and [:digit:] only work 
with + or * or {}, it's a bug.


[:space:] by itself, all alone, should recognize exactly one white 
character.


Square brackets enclose a character class. A character class is a list 
of atoms. An atom is a matchable entity. The only thing the square 
brackets do is allow any one of the atoms inside to match at a given 
point in a string. And the whole square bracket list is itself an atom 
(note: just one atom!), it's just an atom that can match different 
target characters at different positions in a target string.


+ and * are quantifiers. A quantifier means how many of.

So an atom (including a square bracket atom) plus a quantifier means 
how many of this. But an atom without any quantifier at all ought to 
be interpreted as one of this.


I think maybe what Uwe meant was that it is not possible to search for 
:space: by itself. This is (almost) true. :space: will not locate a 
white character in a target string.


(Without the square brackets, :space: is 7 atoms, a colon, a character 
s, a character p, ... all in the exact order listed, and it will match 
that literal 7 character sequence in a target string. But that was not 
the original intent.)


But :space: inside square brackets is not a 7 character sequence. Square 
brackets create a special context in which :space: is recognized as a 
shorthand for the list of white characters of the current alphabet, and 
the whole list becomes a single atom. And as a valid atom, a quantifier 
is allowed but should *not* be required.


Another thing Uwe might have been trying to say is that it is not valid 
to quantify a quantifier. This is completely true. It is not valid to 
try to match +* for example. This would mean something like any number 
of at least one of, except that it's meaningless. A regular expression 
can match a count of things, but it's not possible to just match a 
count, much less a count of counts. To search for any number of literal 
plus characters, you must escape the + character with a backslash: 
\+ (but without the quotes). This strips off the quantifier meaning of 
the plus character, reverting it temporarily to its literal alphabet 
character meaning. Thus, \+* (without the quotes) means any number of 
consecutive literal plus characters, \++ (without the quotes) means 
at least one consecutive literal plus character, and \+\+ (without 
the quotes) means exactly two consecutive literal plus characters.


But [:space:] is not a quantifier, it's an atom, and it is legal, but 
not required, to quantify an atom.



When I've written my own book on regular expressions, it will make all 
of this crystal clear. ;)



Uwe Fischer wrote:


Andrew Douglas Pitonyak wrote:

What else can I say besides Does [:space:] work with regular 
expressions?


I can use regular expressions, but I can not make it find a space 
using this syntax, which is documented. I also tested [:digit:], which 
does not work for me. [0-9] works just fine, however. In other words, 
I can use some regular expressions, just not all. I see no issues for 
this. Depending on the answer, I will open an issue.


I am using 2.02 on Linux. I investigated this based on a question here:
http://www.oooforum.org/forum/viewtopic.phtml?p=154379#154379



please use [:space:]+ or [:space:]* as search term.
[:space:] by itself is a regular expression for any white space (look 
up Wiki or Google what a white space is).
You cannot search for a regular expression by itself, in the same sense 
as you cannot search for something as between 3 and 6 times. You 
always must give a parameter what you mean by using the regular expression.
You can find all this in a very short list in Online Help. Be aware that 
a complete discussion of regular expressions can fill a book of 500 
pages, see amazon.com for that keyword.


Regards
Uwe


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-07-01 Thread Donald H Locker
I just tested in 2.0.2 and it is definitely broken.  [:space:] does not 
match anything by itself, whereas it should match the character class of 
whitespaces, as I read it should in the helpfile, and as such a 
construct would behave in other RE engines.  Ditto [:digit:], which 
doesn't match anything, while it should match [0-9] by my reading.


kevin johnston wrote:
In a Regular Expression search, if [:space:] and [:digit:] only work 
with + or * or {}, it's a bug.


[:space:] by itself, all alone, should recognize exactly one white 
character.


[snip]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-07-01 Thread Andrew Douglas Pitonyak

An issue already exists for this... :-)

Donald H Locker wrote:

I just tested in 2.0.2 and it is definitely broken.  [:space:] does 
not match anything by itself, whereas it should match the character 
class of whitespaces, as I read it should in the helpfile, and as such 
a construct would behave in other RE engines.  Ditto [:digit:], which 
doesn't match anything, while it should match [0-9] by my reading.


kevin johnston wrote:

In a Regular Expression search, if [:space:] and [:digit:] only work 
with + or * or {}, it's a bug.


[:space:] by itself, all alone, should recognize exactly one white 
character.



[snip]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-06-27 Thread Niklas Nebel

Andrew Douglas Pitonyak wrote:
I can use regular expressions, but I can not make it find a space using 
this syntax, which is documented. I also tested [:digit:], which does 
not work for me. [0-9] works just fine, however. In other words, I can 
use some regular expressions, just not all. I see no issues for this. 
Depending on the answer, I will open an issue.


There's issue 64368.

Niklas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-06-27 Thread Andrew Douglas Pitonyak


Uwe Fischer wrote:


Andrew Douglas Pitonyak wrote:

What else can I say besides Does [:space:] work with regular 
expressions?


I can use regular expressions, but I can not make it find a space 
using this syntax, which is documented. I also tested [:digit:], 
which does not work for me. [0-9] works just fine, however. In other 
words, I can use some regular expressions, just not all. I see no 
issues for this. Depending on the answer, I will open an issue.


I am using 2.02 on Linux. I investigated this based on a question here:
http://www.oooforum.org/forum/viewtopic.phtml?p=154379#154379



please use [:space:]+ or [:space:]* as search term.
[:space:] by itself is a regular expression for any white space 
(look up Wiki or Google what a white space is).
You cannot search for a regular expression by itself, in the same 
sense as you cannot search for something as between 3 and 6 times. 
You always must give a parameter what you mean by using the regular 
expression.
You can find all this in a very short list in Online Help. Be aware 
that a complete discussion of regular expressions can fill a book of 
500 pages, see amazon.com for that keyword.


Regards
Uwe


OK, that does work for me... I searched for [:digit:]{1}. I have often 
considered purchasing the regular expressions book because I have done 
some pretty strange regular expressions using things such as look ahead...


What if I want to find anything that is NOT a [:space:]?

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[users] Does [:space:] work with regular expressions?

2006-06-26 Thread Andrew Douglas Pitonyak

What else can I say besides Does [:space:] work with regular expressions?

I can use regular expressions, but I can not make it find a space using 
this syntax, which is documented. I also tested [:digit:], which does 
not work for me. [0-9] works just fine, however. In other words, I can 
use some regular expressions, just not all. I see no issues for this. 
Depending on the answer, I will open an issue.


I am using 2.02 on Linux. I investigated this based on a question here:
http://www.oooforum.org/forum/viewtopic.phtml?p=154379#154379

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [users] Does [:space:] work with regular expressions?

2006-06-26 Thread Uwe Fischer

Andrew Douglas Pitonyak wrote:

What else can I say besides Does [:space:] work with regular expressions?

I can use regular expressions, but I can not make it find a space using 
this syntax, which is documented. I also tested [:digit:], which does 
not work for me. [0-9] works just fine, however. In other words, I can 
use some regular expressions, just not all. I see no issues for this. 
Depending on the answer, I will open an issue.


I am using 2.02 on Linux. I investigated this based on a question here:
http://www.oooforum.org/forum/viewtopic.phtml?p=154379#154379



please use [:space:]+ or [:space:]* as search term.
[:space:] by itself is a regular expression for any white space (look 
up Wiki or Google what a white space is).
You cannot search for a regular expression by itself, in the same sense 
as you cannot search for something as between 3 and 6 times. You 
always must give a parameter what you mean by using the regular expression.
You can find all this in a very short list in Online Help. Be aware that 
a complete discussion of regular expressions can fill a book of 500 
pages, see amazon.com for that keyword.


Regards
Uwe
--
  [EMAIL PROTECTED]  -  Technical Writer
  StarOffice - Sun Microsystems, Inc. - Hamburg, Germany
  http://www.sun.com/staroffice
  http://documentation.openoffice.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[users] conditions on fields/section regular expressions

2005-11-12 Thread office
Hi all.

I only found the possibility of using regular expression in find/replace
and filtering functions.
Now I need to make some text to change in a merge-mail process if the
value in a db field is of type *999, but i can't find the way to do so.
Am I missing something or at the moment this capability in not provided?

Thank you.

Marco



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]