Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Tool CE Lua Regular Expression

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 149
Location: Russia

PostPosted: Tue May 16, 2017 9:14 am    Post subject: Tool CE Lua Regular Expression Reply with quote

Tool CE Lua Regular Expression

For: string.match(); string.gmatch()

Hints:
1. Pastle GHL_ClassSettings.lua to autorun folder
2. Rename file "Lua Regular expression.CETRAINER[delete.lua" to "Lua Regular expression.CETRAINER"
3. Run the "Lua Regular expression.CETRAINER"

Quote:
. all characters
%a letters
%c control characters
%d digits
%l lower case letters
%p punctuation characters
%s space characters
%u upper case letters
%w alphanumeric characters
%x hexadecimal digits
%z the character with representation 0


20.2 Patterns
Quote:
https://www.lua.org/pil/20.2.html

Lua Patterns and Captures (Regular Expressions)
Quote:
http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)


Source:
Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="24">
  <Forms>
    <frmReg Class="TCEForm" Encoding="Ascii85">eU!@i,dveC=J=L,X%MPfpcf:BibSD86tz.jBrcbzK_!)AE*a^sKG-A1GttZ#5[aA93Hnfdrj8vau_w63:XQ=1_37CuKbH)6yf]@/LjU-Li[E=e+#MHI9@5GF5ZPxyl2lpDv[d_#ejCd[NUT!p#$4%e5rgPPoXM4@+CZHA1:%@U,@CKMHKyRW+YYdDlqZglhl,4!ulI87X,{:5?L*6*Af=]a;Qe$t(44SD@[15RQhwiMA)potEF4#:BYKa:)kPT4$3!]k.X@4MZB*w9i$XX$sC2KHZiuh?g+.;_g*maKyM4K^zx![c$[.:93JZnYmY)+2B]QURQ4-D{/IZHL2%A(Fs3d%:2%pV%k1(w=ff9rz)zG],e(,!mz4tEl+W2=xdb^3%e]U/2m}-}aCcCBCom=r-o:hjF^YiKB%(CIsb(u%ntkUSTKWCsvMh:?stY1di/UhvD%CgTX7tU%#k0M3xVA9w^gR6[a27u!{qvO[]Zp_I8H66CKr}!?%KNUP5w)E//Uhb4WQ6:w-:@o^ZpAbr0Z}T/dI3N#N)SDIMC:!Apj]Rkyx9Z2oOkcbN(bS}CoGDD5%{B@Ip78]2(t){q07*L.@+^2ygHR..Usgj+km?Sk*=lkTEztQ.M#*!=gJ+/:({R+kc,7L/Y)*^)MG1L[;$^PKDX[wR$jbsW@!u7GIF%P5iUuOH?yDU^#t-+NpK[XKtm14(bSkT0*cj1sBtosOegL^Gh7mH[#k[V!md},?Qrjs9khQC=-yh;I</frmReg>
  </Forms>
  <CheatEntries/>
  <UserdefinedSymbols/>
  <LuaScript>function Main16052017()

  classSettings = ClassSettings:New('userdata.txt', '*.txt')


  function Finding()
    if frmReg.CERadioGroup1.ItemIndex == 0 then
      frmReg.CEMemo2.Lines.Text = string.match(frmReg.CEMemo1.Lines.Text, frmReg.CEEdit1.Text)
    else
      local tempString = ''
      for w in string.gmatch(frmReg.CEMemo1.Lines.Text, frmReg.CEEdit1.Text) do
        tempString = tempString..w..';'
      end
      frmReg.CEMemo2.Lines.Text = tempString
    end

    classSettings:Set('textRegular', frmReg.CEEdit1.Text)
  end

  if classSettings:HasKey('frmReg') then
    classSettings:LoadForm(frmReg, 'frmReg')
  end

  frmReg.OnResize = function()
    classSettings:SaveForm(frmReg, 'frmReg')
  end

  frmReg.CEEdit1.Text = classSettings:Get('textRegular', '%[(.*)%]')

  frmReg.CEButtonGO.OnClick = function (sender)
    Finding()
  end

  frmReg.CEMemo1.Lines.Text = classSettings:Get('textMain', 'mov eax, [eax + 4 * 0C]')
  frmReg.CEMemo1.OnChange = function (sender)
    Finding()
  end

  Finding()

  frmReg.OnClose = function (sender)
    classSettings:Save()
    closeCE()
    return caHide
  end

  frmReg.Show()
end

Main16052017()
</LuaScript>
</CheatTable>



Lua Regular expression2.png
 Description:
 Filesize:  7.25 KB
 Viewed:  2143 Time(s)

Lua Regular expression2.png



Lua Regular expression.png
 Description:
 Filesize:  7.24 KB
 Viewed:  2160 Time(s)

Lua Regular expression.png



Lua Regular expression.CETRAINER[delete.lua
 Description:

Download
 Filename:  Lua Regular expression.CETRAINER[delete.lua
 Filesize:  1.53 KB
 Downloaded:  252 Time(s)


GHL_ClassSettings.lua
 Description:

Download
 Filename:  GHL_ClassSettings.lua
 Filesize:  2.91 KB
 Downloaded:  223 Time(s)



Last edited by GH*master on Tue May 16, 2017 10:05 am; edited 2 times in total
Back to top
View user's profile Send private message
FreeER
Expert Cheater
Reputation: 6

Joined: 09 Aug 2013
Posts: 148

PostPosted: Tue May 16, 2017 9:39 am    Post subject: Reply with quote

is the trainer required or simply a demo of what the autorun file provides?

Just asking because you haven't made it completely obvious and it seems like having simple string.regex and string.regexAll functions would be more useful than a GUI. Though it seems implied that it's replacing string.match() and string.gmatch()...

Unless it supports character classes and repeated characters (+,*,-,?) etc. then I don't think I'd call it regex anymore than I would lua's pattern matching (which was done because a true regex implementation would be larger than the entirety of lua now). More of a wildcard extension for lua's pattern matching. Calling it regex sets up an expectation and not meeting that will lead to people being disappointed which many people turn into annoyance/anger...
Back to top
View user's profile Send private message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 149
Location: Russia

PostPosted: Sun Jun 18, 2017 2:01 am    Post subject: Update Reply with quote

Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="26">
  <Forms>
    <frmReg Class="TCEForm" Encoding="Ascii85">=O4rk8${df?5XCyoTP/+DQ)q]qHM9##EoMYsYofbR?z2NnkWteRB^-vC-y4q9cy/saf:Wq5IrGr;IK9JaRec8fg:Zm.D(=^e+zyDIB^ZTclI.u#v!c]5./gMy*)c0y_-]P?68m=3Bu/3t?,$$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dCXmTs[NGgm)GT{!0pViJ^/mhEFD[?Yfnx7YYF*u5rhIIQSTsa:O+qS:iMgmue01zi/d@=GcJ$6^I4)+R-f,hSXn^.^ss</frmReg>
  </Forms>
  <CheatEntries/>
  <UserdefinedSymbols/>
  <LuaScript>function RegCEButtonGO1Click(sender)
  frmReg.CEMemoResult1.Lines.Text = string.match(
     frmReg.CEMemoInputString1.Lines.Text,
     frmReg.CEEditPattern1.Text, frmReg.CEEditInit1.Text)
end

function RegCEButtonGO2Click(sender)
  local tempString = ''
  for w in string.gmatch(frmReg.CEMemoInputString2.Lines.Text,
    frmReg.CEEditPattern2.Text) do
    tempString = tempString..w..';'
  end
  frmReg.CEMemoResult2.Lines.Text = tempString
end

function RegCEButtonGO3Click(sender)
  frmReg.CEMemoResult3.Lines.Text = string.gsub( frmReg.CEMemoInputString3.Lines.Text,
     frmReg.CEEditPattern3.Text, frmReg.CEEditRepl3.Text,
     tonumber(frmReg.CEEditN3.Text))
end

function RegCEButtonGO4Click(sender)

   local a, b, c1, c2, c3, c4, c5, c6, c7, c8, c9 = string.find(frmReg.CEMemoInputString4.Lines.Text,
    frmReg.CEEditPattern4.Text,
    tonumber(frmReg.CEEditInit4.Text),
    frmReg.CECheckboxPlain4.Checked)


    local s = a..' '..b
    if c9 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4..' '..c5..' '..c6..' '..c7..' '..c8..' '..c9
    elseif c8 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4..' '..c5..' '..c6..' '..c7..' '..c8
    elseif c7 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4..' '..c5..' '..c6..' '..c7
    elseif c6 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4..' '..c5..' '..c6
    elseif c5 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4..' '..c5
    elseif c4 ~= nil then s = s..' '..c1..' '..c2..' '..c3..' '..c4
    elseif c3 ~= nil then s = s..' '..c1..' '..c2..' '..c3
    elseif c2 ~= nil then s = s..' '..c1..' '..c2
    elseif c1 ~= nil then s = s..' '..c1 end

    frmReg.CEMemoResult4.Lines.Text = s

end

function FormClose(sender)
  closeCE()
  return caHide --Possible options: caHide, caFree, caMinimize, caNone
end

frmReg.Show()
</LuaScript>
</CheatTable>



RegularExpression.png
 Description:
 Filesize:  23.51 KB
 Viewed:  377 Time(s)

RegularExpression.png


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites