Search
 
SCRIPT & CODE EXAMPLE
 

LUA

lua patterns

-- Lua Patterns is Lua's very own version of Regex
-- The Regex library is much bigger than Lua itself, so Lua Patterns was
-- implemented to still allow developers to automate string searching

-- These are to find directories and files that are emitted by
-- the Windows `dir .` command
local FileP = "%d+%s[%a%.%d_-]+
" -- NOTE This will still include the number next to the filename which represents how big the file is in bytes
local DirP = "<DIR>%s+[%a%.%d_-]+
" -- NOTE This will still include <DIR>

-- Lua Patterns is similar to Regex in alot of ways, %a represents
-- all letters and %A everything BUT letters.
-- [] represents a group of things to search for and [^] represents
-- a group of things to NOT search for.
-- * represents 0 or more matches, + represents 1 or more matches.

-- Searches for a single Pattern match in Text and replaces it with
-- ReplaceText and returns a new string
function SearchAndReplace(Text,Pattern,ReplaceText)
	return string.gsub(Text,Pattern,ReplaceText,1)
end

Comment

PREVIOUS NEXT
Code Example
Lua :: roblox set color of text 
Lua :: lua remove duplicates from table 
Lua :: dubble and big comment 
Lua :: how do i use the errors module luaassist 
Lua :: how to make a math text in lua 
Lua :: In range loop 
Lua :: how to enable https service roblox 
Lua :: How to use Humanoids in Roblox Lua 
Matlab :: matlab get real and imaginary part 
Matlab :: octave disable warning 
Matlab :: matlab make symbolic matrix 
Matlab :: matlab function without output 
Matlab :: how to print ceratin rows of dataframe 
Basic :: git access token 
Basic :: Detailview with form mixing 
Basic :: visual basic excel freeze first row 
Elixir :: elixir reverse list 
Elixir :: phoenix ecto query expression 
Scala :: ValueError: If using all scalar values, you must pass an index 
Scala :: scala predicate 
Actionscript :: from sys import stdin 
Excel :: google sheets split cell by delimiter 
Excel :: google sheets filter cells that match word 
Perl :: perl format decimal 2 places not rounding 
Pascal :: array pascal 
Powershell :: How to save Jira attachments using powershell 
Abap :: abap data conversion 
Assembly :: install retroarch on Linux 
Assembly :: dokuwiki redirect 
Javascript :: jquery vslidation remove spaces from input 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =