Ah!..... hehe, my apologies
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"David Morgan" <david@davidmorgan.me.uk> wrote in message
news:uW350GEjEHA.704@TK2MSFTNGP12.phx.gbl...[color=blue]
> I don't mean to be rude Steve but you really have missed the point on this
> one.
>
> Your last sentence is just wrong irrespective of my issue.
>
> If I say Replace("something", "something else", vbTextCompare) then
> "Something" would be converted to "something else". What I am looking[/color]
for,[color=blue]
> (and if you read the other posts in this thread), that has now been
> provided, is to replace "Something" with "Something else" and "something"
> with "something else". In your world I would need two replace statements.
>
> I have only cited two variables here, "Something" and "something". There[/color]
is[color=blue]
> a large amount of variables regarding the case of the word being searched.
> I want the replacement to be in the same case as the occurrence it[/color]
replaced,[color=blue]
> not in the case of the value being searched for.
>
> Hope this clears it up.
>
>
> "Steven Burn" <pvt@noyb.com> wrote in message
> news:euKmk1DjEHA.3320@TK2MSFTNGP11.phx.gbl...[color=green]
> > Not really....... you wanted to know why "Something" was treated as
> > "something"..??
> >
> > Although I know you can, I can't see any point in using RegExp for[/color]
> something[color=green]
> > that can be done with the native Replace() function in one line of code.
> >
> > What your RegExp is doing with "RegExp.IgnoreCase = True" is essentially[/color]
> the[color=green]
> > same as converting the query to lowercase before replacing the[/color][/color]
word/phrase[color=blue][color=green]
> >
> > --
> >
> > Regards
> >
> > Steven Burn
> > Ur I.T. Mate Group
> >
www.it-mate.co.uk
> >
> > Keeping it FREE!
> >
> >
> > "David Morgan" <david@davidmorgan.me.uk> wrote in message
> > news:uIgN6EBjEHA.396@TK2MSFTNGP12.phx.gbl...[color=darkred]
> > > Err... thanks, but you have missed my point.
> > >
> > > "Steven Burn" <pvt@noyb.com> wrote in message
> > > news:eVLreu8iEHA.2448@TK2MSFTNGP12.phx.gbl...
> > > > Function Highlight(sFind, sSearch)
> > > > Highlight = Replace(sSearch, sFind, "<span class=""highlight"">"[/color][/color][/color]
&[color=blue][color=green][color=darkred]
> > > sFind
> > > > & "</span>")
> > > > End Function
> > > >
> > > > --
> > > >
> > > > Regards
> > > >
> > > > Steven Burn
> > > > Ur I.T. Mate Group
> > > >
www.it-mate.co.uk
> > > >
> > > > Keeping it FREE!
> > > >
> > > >
> > > > "David Morgan" <david@davidmorgan.me.uk> wrote in message
> > > > news:#yB0Rl8iEHA.2696@TK2MSFTNGP11.phx.gbl...
> > > > > Hello
> > > > >
> > > > > I have a little function to highlight text if it exists.
> > > > >
> > > > > Function Highlight(vFind, vSearch)
> > > > > Dim RegEx
> > > > > Set RegEx = New RegExp
> > > > > RegEx.Pattern = vFind
> > > > > RegEx.IgnoreCase = True
> > > > > Highlight = RegEx.Replace(vSearch, "<span class=""Highlight"">" &[/color]
> > vFind[color=darkred]
> > > &
> > > > > "</span>")
> > > > > Set RegEx = Nothing
> > > > > End Function
> > > > >
> > > > > The only problem is, that if I search for "something", "something"
> > > appears
> > > > > highlighted when the string being searched actually contained
> > > "Something".
> > > > > This is not about case sensitive searching, this is about showing[/color][/color]
> the[color=green][color=darkred]
> > > > actual
> > > > > match rather than what was being searched for. Hope that makes[/color][/color]
> sense.[color=green][color=darkred]
> > > > >
> > > > > For example:
> > > > >
> > > > > Response.Write Highlight("something", "Have you seen Something[/color][/color]
> About[color=green][color=darkred]
> > > > > Mary?")
> > > > >
> > > > > Gives:
> > > > >
> > > > > Have you seen <span class="Highlight">something</span> About Mary?
> > > > >
> > > > > Whilst this is ok, it would be great if it actually highlighted[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > match
> > > > > rather than the 'find, i.e:
> > > > >
> > > > > Have you seen <span class="Highlight">Something</span> About Mary?
> > > > >
> > > > > I have looked in to the documentation a bit and it seems that to[/color][/color][/color]
do[color=blue][color=green]
> > what[color=darkred]
> > > I
> > > > > want involves using the execute method and then hunting through[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > > matches
> > > > > collection. Does anyone have any sample code for this that I[/color][/color][/color]
could[color=blue][color=green][color=darkred]
> > > > > _borrow_?
> > > > >
> > > > > My function is nice and small and it would be a shame to have to[/color][/color][/color]
go[color=blue][color=green]
> > for[color=darkred]
> > > > > something bigger, (a.k.a. performance degradation), if a simple[/color][/color]
> change[color=green][color=darkred]
> > > can
> > > > > be made to my function.
> > > > >
> > > > > I am open to suggestions on the JScript approach also as I notice[/color]
> > these[color=darkred]
> > > > > special characters $0 - $9 although MSDN is somewhat lacking in[/color][/color]
> sample[color=green][color=darkred]
> > > > code
> > > > > for a novice like me.
> > > > >
> > > > > MTIA
> > > > >
> > > > > David
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]