Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

2 strings appear the same but don't match

Quote Reply
2 strings appear the same but don't match
What could be an explanation if two strings look exactly the same but do not match for one string but match for all others using

<%if $variable eq $match%> is false?

In other words, 99% match and 1 string fails and tried all combinations whitespace in front, etc...
Quote Reply
Re: [scorpioncapital] 2 strings appear the same but don't match In reply to
Which string is it? Could be a newline/return (\n or \r) if its a custom tag...

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] 2 strings appear the same but don't match In reply to
Very interesting!

I got the string to match using 'like'...The string was 'Hot Legs And Feet'. It did not want to match at all even though it looked identical.

Here are the results:

like 'Hot' -> Match

like 'Hot Legs' -> Match

like 'Hot Legs And' -> Match

like 'Hot Legs And Feet' -> fail

eq 'Hot Legs And Feet' -> fail
Quote Reply
Re: [scorpioncapital] 2 strings appear the same but don't match In reply to
What fields are you trying to compare? Are the LinksSQL default fields?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] 2 strings appear the same but don't match In reply to
it is the default LSQL field $title (appears on a detailed page). However, I am running the following code on this string:

split(/: /)

It works for 9 out of 10 categories were the middle parameter (one: two: three) is extracted as the string to compare...
Quote Reply
Re: [scorpioncapital] 2 strings appear the same but don't match In reply to
Try this to clean things up;

Code:
$var =~ s/\s$//; # get rid of trailing spaces...
$var =~ s/^\s//; # get rid of leading spaces...
$var =~ s/\n$//; # get rid of trailing newlines
$var =~ s/^\n//; # get rid of leading newlines...

Any better? I'm assuming when you say you were using split(), it was in a global?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] 2 strings appear the same but don't match In reply to
Nope, same as before, very weird what could be in that string to make it not match...yes split in a global