Colour Problem Again. (I solved it! Nevermind!)

Posted by Neoshain on Thu 03 Oct 2013 11:51 PM — 5 posts, 18,939 views.

#0
Ok, so I have this alias:


<aliases>
  <alias
   match="rpose*"
   enabled="y"
   send_to="12"
   omit_from_output="y"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>

message = string.gsub ("%1", "'(%a*%d*%s*%p*)'", "'@c%%1@y'")

Send("rpose @y" ..message.."@n")




</send>
  </alias>
</aliases>



What I'm trying to get is when I rpose something, anything within single quotes, (I'll also set it to do double quotes, but I'm just trying to get this working first) is in Dark Cyan. ("@c" is the colour code.)

Right now, the way it's working, any SINGLE word withing single quotes is changed. Punctuation and numbers are coloured too.

If I have any spaces there, it fails.

For instance, the following colours the "Hello!" but not the "Does this work" part.

Quote:

rpose Checking to see if this will work, 'Hello!' I hope it works. 'Does this work?'


I've tried lots of things, can't figure this out. :-( If I change the "Hello!" to "Hello there!" it fails.
Australia Forum Administrator #1
You want a set, rather than what you did.

However this seems to work:


<aliases>
  <alias
   match="rpose*"
   enabled="y"
   send_to="12"
   omit_from_output="y"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>

message = string.gsub ("%1", "'(^'-)'", "'@c%%1@y'")

Send("rpose @y" ..message.."@n")

</send>
  </alias>
</aliases>



That searches for a quote, followed by anything which is not a quote, followed by a quote.

The "set" looks like this:


<aliases>
  <alias
   match="rpose*"
   enabled="y"
   send_to="12"
   omit_from_output="y"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>

message = string.gsub ("%1", "'([%a%d%s%p]*)'", "'@c%%1@y'")

Send("rpose @y" ..message.."@n")

</send>
  </alias>
</aliases>

#2
Hmm, this still comes with a problem, It is colouring everything from "Hello" to "Work?" because I believe it is trying to match three "quoted" blocks.

Quote:

'Hello?'

Quote:

' I hope it works. '

Quote:

'Does this work?'


So what I'm trying to get it to do is only match when the quote has no spaces after the first single quote and no space before the last single quote.
#3
Nope, I looked closer, and it's reading the quote as being from the very first single quotation mark -

Quote:

'Hel....


To the very last one.

Quote:

...work?'


I can't get it to stop matching after the first set of quotation marks. It DOES stop matching after the last one, because when I added text after it, without any more quotation marks

Quote:

Checking to see if this will work, 'Hello!' I hope it works. 'Does this work?' Well? Did it?


It coloured only the following, which is still too much:

Quote:

'Hello!' I hope it works. 'Does this work?'

Amended on Fri 04 Oct 2013 01:15 PM by Neoshain
#4
I GOT IT!

<aliases>
<alias
match="rpose*"
enabled="y"
send_to="12"
omit_from_output="y"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>

message = string.gsub ("%1", "'([%a%d][%a%d%s.:;!?]*)'", "'@c%%1@y'")
Note(message)
Send("rpose @y" ..message.."@n")

</send>
</alias>
</aliases>


The problem was tt was matching ' as part of the %p set, thus it just kept going over it. Thanks for your help!