Skip to content
  • Fight Night
  • Server Release
  • Testing Sessions
  • Server Rules (All Servers)
  • (In) Territory Laws
  • City Laws
  • Drained Server Rules
  • Devastated Server Rules
  • Little Creek Server Rules
  • In For A Penny Server Rules
Territory

Territory

Western RP with a Twist

  • Calendar of Events
  • FAQ’s
  • Tutorials
  • Contact Staff
  • Server List
  • Server Rules (All Servers)
  • Toggle search form

How do I regex out special characters in RedM/CFX/Lua?

Posted on November 13, 2022November 13, 2022 By Crimson Creek Team No Comments on How do I regex out special characters in RedM/CFX/Lua?

A: Lua has special characters, and a few they label as magic. It makes regex-ing out normal ASCII characters just a little more complicated. The first one I ran into is the [It’s used in a few special ways in Lua so to regex it out you have to use a delimiter.

output_string = string.gsub(input_string, "%[", "") -- [ \091 
output_string = string.gsub(input_string, "%]", "")  -- ] \093
output_string = string.gsub(input_string, "{", "") 
output_string = string.gsub(input_string, "}", "")  
output_string = string.gsub(input_string, "\"", "") 

So the above shows examples of some weird ones to regex out.

Crimson Creek Team

Crimson Creek Team, a group of volunteers working together to have a good time RPing and running our servers.

See author's posts

Hits: 0

Blog, Code Tutorials Tags:braces, brackets, cfx, cowboy, cowgirl, gsub, quotes, rdo, rdr3, red dead, redm, regex, roleplay, rp, string, tutorial, video game, welcome, western

Post navigation

Previous Post: When I add a resource to the server (redm / cfx / lua), TXAdmin doesn’t show the new directory or files.
Next Post: Interiors – House on Fire

Related Posts

Tutorails for Redm, CFX, or Vorp RedM/CFX/VORP Project – new vorp on ubuntu? Blog
How do I do random in RedM/CFX/Lua? Blog
Tutorails for Redm, CFX, or Vorp Dev Blog – July 9th Blog
Tutorails for Redm, CFX, or Vorp RedM/CFX/VORP Project – whitelist error when server.cfg has whitelist off. Blog
Server Thumbnail Crimson Creek – VORP Testing Blog
Tutorails for Redm, CFX, or Vorp When I use print statements, nothing prints. Blog

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


Newsletter



Holiday Events

There are no upcoming events.

Archive

  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022

Donations

Patreon

Kofi

There are no upcoming events at this time

February 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728  
« Dec    

Copyright © 2023 Territory.

Powered by PressBook Masonry Dark

Loading...

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.