Jump to content

_StringSplitRegExp


weaponx
 Share

Recommended Posts

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author: WeaponX

 Script Function:
    Split string on regular expression
 
 Parameters:
    String = String to be split
    Pattern = Pattern to split on
    IncludeMatch = True / False - Indicates whether or not to include the match in the return (back-reference)
    Count =  Number of splits to perform

#ce ----------------------------------------------------------------------------
Func _StringSplitRegExp($sString, $sPattern, $sIncludeMatch = false, $iCount = 0)
    
    ;All matches will be replaced with this string
    Local $sReservedPattern = Chr(0)
    Local $sReplacePattern = $sReservedPattern
    
    ;Modify the reserve pattern to include back-reference
    If $sIncludeMatch Then $sReplacePattern = "$0" & $sReplacePattern
    
    ;Replace all occurences of the search pattern with a replace string
    $sTemp = StringRegExpReplace($sString, $sPattern, $sReplacePattern, $iCount)
    
    ;Strip trailing character if it matches the reserved pattern
    If StringRight($sTemp, 1) = $sReservedPattern Then $sTemp = StringTrimRight($sTemp, 1)
    
    ;Split string using entire reserved string
    $aResult = StringSplit($sTemp, $sReservedPattern, 1)

    Return $aResult
EndFuncoÝ÷ ØLZ^±«­¢+Ø¥¹±Õ±ÐíÉÉä¹ÔÌÐì((íMÁ±¥Ð¥¹Ñ¼Á¥ÉÌ¡lÁtôÜ°lÅtô°lÉtô°lÍtô°lÑtô°lÕtô°lÙtô°lÝtô¤(ÀÌØíÍÑÉ¥¹ÄôÅÕ½ÐíÅÕ½Ðì(ÀÌØíÉÍÕ±ÐÄô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹Ä°Ìäì ¸¥ìÉôÌäì°ÑÉÕ¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐÄ°ÅÕ½Ðí1ÑÑÈÁ¥ÉÌÅÕ½Ðì¤((íMÁ±¥Ð¡Í ±¥µ¥Ñ¤¡lÁtôÜ°lÅtô°lÉtô°lÍtô°lÑtô°lÕtô°lÙtô°lÝtô¤(ÀÌØíÍÑÉ¥¹ÈôÅÕ½ÐíµµµµµµÅÕ½Ðì(ÀÌØíÉÍÕ±ÐÈô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹È°Ìäì ´¤Ìäì¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐÈ°ÅÕ½Ðí1ÑÑÈÁ¥ÉÌ°ÍÁ±¥ÐäÍ ÅÕ½Ðì¤((íMÁ±¥Ð¡µ¥Í±±¹½Õ̱¥µ¥Ñ¤¡lÁtôÜ°lÅtô°lÉtô°lÍtô°lÑtô°lÕtô°lÙtô°lÝtô¤(ÀÌØíÍÑÉ¥¹ÌôÅÕ½ÐíÌÌíÀÌØíyµÀíÅÕ½Ðì(ÀÌØíÉÍÕ±ÐÌô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹Ì°Ìäímylé±¹Õ´éutÌäì¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐÌ°ÅÕ½Ðí1ÑÑÈÁ¥ÉÌ°ÍÁ±¥ÐäÙÉ¥½Õ̱¥µ¥ÑÉÌÅÕ½Ðì¤((íMÁ±¥Ð¡ÕÁÁÉͱ¥µ¥Ñ¤¡lÁtôÜ°lÅtô°lÉtô°lÍtô°lÑtô°lÕtô°lÙtô°lÝtô¤(ÀÌØíÍÑÉ¥¹ÐôÅÕ½Ðí   
ÅÕ½Ðì(ÀÌØíÉÍÕ±ÐÐô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹Ð°ÌäímléÕÁÁÈéutÌäì¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐаÅÕ½Ðí1ÑÑÈÁ¥ÉÌ°ÍÁ±¥ÐäÕÁÁÈͱÑÑÉÌÅÕ½Ðì¤((íMÁ±¥Ðչѥ½¸½±Í͹µ¥¹Ñ¼Ý½ÉÌ¡lÁtôаlÅtôQ¡¥Ì°lÉtô%Ì°lÍtô°lÑtôQÍФ(ÀÌØíÍÑÉ¥¹ÔôÅÕ½ÐíQ¡¥Í%ÍQÍÐÅÕ½Ðì(ÀÌØíÉÍÕ±ÐÔô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹Ô°ÌäímµhÀ´åumyµit¨Ìäì°ÑÉÕ¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐÔ°ÅÕ½ÐíMÁ±¥Ðչѥ½¸½±Í͹µ¥¹Ñ¼Ý½ÉÌÅÕ½Ðì¤((íMÁ±¥ÐÁÉÉÁ ¥¹Ñ¼Í¹Ñ¹Ì¡ÙÉ¥½ÕÌÁÕ¹ÑÕÑ¥½¸¤¡lÁtôÔ°lÅtôᱵѥ½¸ÌÌì°lÉtô±±¥Á̸ͥ¸¸°lÍtô͹ѹ½¹Ñ¥¹Õ¸°lÑtô5¥ÍÍ¥¹ÑÉ¥±¥¹ÍÁ¸°lÕtôEÕÍÑ¥½¸ü¤(í9=QèQ¡¥Ì¹Ìµ½Éݽɬ¸Ù±¥Í¹Ñ¹Í¡½Õ±±±½ÝѼ¹Ý¥Ñ µ¥à½ÅÕÍÑ¥½¸µÉ­Ì¬á±µÑ¥½¸Á½¥¹ÑÌÕб±¥ÁÍ¥ÌÍ¡½Õ±¹½ÐµÉ¬ÍÁ±¥Ð(ÀÌØíÍÑÉ¥¹ØôÅÕ½Ðíᱵѥ½¸ÌÌì±±¥Á̸ͥ¸¹Í¹Ñ¹½¹Ñ¥¹Õ¸5¥ÍÍ¥¹ÑÉ¥±¥¹ÍÁ¹EÕÍÑ¥½¸üÅÕ½Ðì(ÀÌØíÉÍÕ±ÐØô}MÑÉ¥¹MÁ±¥ÑIáÀ ÀÌØíÍÑÉ¥¹Ø°Ìäì ÀäÈì¹ðÌÌíðÀäÈìü¤ üÌÌìÀäÈ츤Ìäì°ÑÉÕ¤)}ÉÉå¥ÍÁ±ä ÀÌØíÉÍÕ±ÐØ°ÅÕ½ÐíMÁ±¥Ð¥¹Ñ¼Ý½ÉÌÅÕ½Ðì¤

Edited by weaponx
Link to comment
Share on other sites

oo

this is pure gold thanx :)

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

  • 2 months later...
  • 4 years later...

I would like to see some examples, because you told you updated them but I don't see anything...

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

Considering the user hasn't been around for a long time you're unlikely to get a response and secondly it's pretty simple to figure out yourself since it's like StringSplit.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...