mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
Hey guys.

I have noticed that some clients, ie the Java ones, have a feature that when ever you begin a sentence the first letter is always uppercase. Is this possible to incorporate with mIRC? If so how would I do it?

Example:

With the uppercase fucntion turned on...
[Skeletor]Hi everyone

With the uppercase fucntion turned off..
[Skeletor]hi there everyone

Any help would be really great

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Code:
#uppercase off 
on *:INPUT:*: {
  if (/* !iswm $1) || ($ctrlenter) {
    msg $target $iif($left($1,1) islower,$+($upper($v1),$right($1-,-1)),$1-)
    halt
  }
}
#uppercase end

 


/enable #uppercase
/disable #uppercase

/help ON input
/help islower

Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,671
Code:
on *:INPUT:*:{
  if ((/* iswm $1) || ($ctrlenter)) return
  msg $target $upper($left($1,1)) $+ $right($1-,-1)
  halt
}


-genius_at_work

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
I guess the $iif check is not really needed :tongue:

Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
Thats wonderfull, Thank-you all for you help grin

Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
How would I go about making it so that the letter "i" would be replaced with "I".

Example...

With it turned on...

[Skeletor]Hi there, I was wonder....

With it turned off...
[Skeletor]Hi there, i was wonder....

Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,671
Try this:

Code:
on *:INPUT:?,#:{
  if ((/* iswm $1) || ($ctrlenter)) return
  var %text = $regsubex(,$1-,/(?<=^)(\w)/,$upper(\1))
  %text = $regsubex(,%text,/(?<=[.!?]\s)(\w)/g,$upper(\1))
  %text = $regsubex(,%text,/\bi\b/g,I)
  msg $target %text
  halt
}


It will make the first letter of each sentence and i into uppercase.

-genius_at_work

Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
Thank you very much, works really well smile

Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
You could combine those 3 regsubexes into one with alteration.

Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,671
I tried doing that for a while, but it wasn't cooperating. Each regex would work on it's own, but when I combined them, they wouldn't work. I found this information:

Quote:
Zero-width positive lookbehind. Matches at a position to the left of which text appears. Since regular expressions cannot be applied backwards, the test inside the lookbehind can only be plain text. Some regex flavors allow alternation of plain text options in the lookbehind.


on this page: http://www.regular-expressions.info/refadv.html

If you could give me an example, it would be appreciated.

-genius_at_work

Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
For some inspiration, you can take a look at this snippet

EDIT: the regex library that mIRC uses, supports alteration in a lookbehind in case you're wondering, no quantifiers though.

Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
That is awesome!


Link Copied to Clipboard