Ricky Baby Posted April 14, 2003 Share Posted April 14, 2003 ok im trying to make a Preg replace for a m8 and its not working heres what he wants to make function to change the colour of the words using the same way as the Quake 3 engine basicly if i type ^5{^4J^5R^4G^5}^4S^5mifffy ill get the same colouring as in my sig colours: ^1 Red ^2 Green ^3 Yellow ^4 Blue ^5 Light-Blue ^6 Purple ^7 White ^8 Black thx Ric Link to comment Share on other sites More sharing options...
0 Tim Dorr Veteran Posted April 14, 2003 Veteran Share Posted April 14, 2003 \^(\d)([^\^]*?) I think that will do it, with the subpatterns for the number and the word :) Might even be simpler to do with just some string functions, though... Link to comment Share on other sites More sharing options...
0 Ricky Baby Posted April 14, 2003 Author Share Posted April 14, 2003 :| - sorry im not that good in regex, explain pls Link to comment Share on other sites More sharing options...
0 Tim Dorr Veteran Posted April 14, 2003 Veteran Share Posted April 14, 2003 Then don't use RegEx :D No, seriously, this is fairly easy to parse out without using regex. Use strpos() to find the location of a ^ and use the next character to find the color choice. Rather simple :) Link to comment Share on other sites More sharing options...
Question
Ricky Baby
ok im trying to make a Preg replace for a m8 and its not working
heres what he wants
basicly if i type
^5{^4J^5R^4G^5}^4S^5mifffy
ill get
the same colouring as in my sig
colours:
^1 Red
^2 Green
^3 Yellow
^4 Blue
^5 Light-Blue
^6 Purple
^7 White
^8 Black
thx Ric
Link to comment
Share on other sites
3 answers to this question
Recommended Posts