Re: Find & Replace Question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Dave:

Yeah, on the syntax, ~ should have been ^ -- that's what I get for
posting un-tested code.

OTOH, I just tried [^&]&[^&] and it works as advertised -- it finds &'s
that are not also &&'s. This works in VS 2005; but I don't know about
VS2003.

Based on what the OP wanted, I would probably modify the RE to
[^&]&[^=&] in order to bypass the &= operator.

--
// Lee Silver
// Information Concepts Inc.


Dave Sexton wrote:
Hi Lee,

Good idea (incorrect syntax though). Based off that pattern I got this to
work:

&~([&:b])

However, it will match the last "&" in "&&" when it's not immediately
followed by a space or tab. In other words, the pattern matches "&", and
the last "&" in "&&", but not, "&& ".

I thought it might be acceptable since it's common for && to be followed by
at least one space in code. If you can't guarantee that, then the pattern
will not work for you.

Just FYI,

[^&]&[^&] and ~(&)&~(&)

didn't work for me, unfortunately.

HTH

--
Dave Sexton

"Lee" <lsilver@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1165075827.716564.276240@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The following untested RegExp might work:

[~&]&[~&]

It should find an & that is neither preceded nor followed by an &.

--
// Lee Silver
// Information Concepts Inc.

inpuarg wrote:
I want to find a & character using Regex. But not &&
How can i manage this in c# Quickfind window ?
--------------------------------------------------
ne kadar yaþarsan yaþa
sevdiðin kadardýr ömrün :(
--------------------------------------------------

.



Relevant Pages

  • Re: Feature request: String-inferred names
    ... especially since all the proposed syntax are ugly (the most acceptable ... When I first started seeing @ show up in Python code, ... the EXACT syntax of the ... The pattern manifested itself ...
    (comp.lang.python)
  • Re: Feature request: String-inferred names
    ... especially since all the proposed syntax are ugly (the most acceptable ... When I first started seeing @ show up in Python code, ... the EXACT syntax of the ... The pattern manifested itself ...
    (comp.lang.python)
  • Re: a SED need
    ... > every syntax I've tried has not worked. ... character is used for regular expression rather than a possible RE ... The match regular expression is repeated in gsub ... Therefore the next match-all pattern ...
    (freebsd-questions)
  • Re: please recommend book or web page on beginners lambda calculus
    ... because I can't recall the notation, precedence, etc. ... the syntax used in those ... slides I have never seen before. ... need to distinguish between a pattern parameter (match the pattern this ...
    (comp.lang.functional)
  • Re: Scheme closures
    ... > were writing the macro in a good way. ... It's useful to be able to choose between pattern matching or not. ... "Stx" is the syntax object representing the source syntax, ... In syntax-rules, the identifier in that position is ignored, and there's no ...
    (comp.lang.lisp)