Jump to content

Cleaner code?


tsue
 Share

Recommended Posts

hello, i was wondering if there is a better way or a cleaner way to do this with relguar expressions

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

$line = '<input type="checkbox" name="answers[b]" class="optInput" id="answers_b" />                                    <pre class="np">text/plain</pre>'



$strLetterLeft = 'name="answers['
$strLetterRight = ']"'

$findletter = StringRegExp($line, '\Q' & $strLetterLeft & '\E' & "(.*?)" & '\Q' & $strLetterRight & '\E' , 3, 1)
For $i = 0 To UBound($findletter) - 1
        $strAnswerLeft = '<pre class="np">'
        $strAnswerRight = '</pre>'

        $findanswer = StringRegExp($line, $strAnswerLeft & "(.*?)" & $strAnswerRight , 3, 1)
        For $i = 0 To UBound($findanswer) - 1

            $stringrep2 = StringRegExpReplace($line, '<([^%]*?)/pre>', '<b>' & StringUpper($findletter[0]) & '.</b> ')
            $varStringFinal = $stringrep2 & '<span class="np">' & $findanswer[0] & '</span>'
            MsgBox(0, "replaced", $varStringFinal)
        Next
Next

 

Link to comment
Share on other sites

They already are regular expressions...

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

On 6/1/2017 at 3:55 PM, careca said:

They already are regular expressions...

 

my bad i mean keeping regular expressions in the code. just to make the coding better or cleaner like a pro coder will do

Link to comment
Share on other sites

Im not a pro coder, so i cannot help. Code seems good enough to me. XD

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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...