Jump to content
Sign in to follow this  
tsue

Cleaner code?

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

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Maybe have a look at the Best Coding Practices :)


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites
27 minutes ago, tsue said:

wow what a great page thanks :)

My pleasure :D.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...