Jump to content

Input only HEX (mac format)


Go to solution Solved by Kyan,

Recommended Posts

  • Moderators

Hi, editcheck. It is great letting us know what you need. How about what you have tried on your own, and what difficulties you're running into?

We operate mainly on a "teach a man to fish" motto, rather than some forums where you put in a request and someone simply barfs up code for you :)

You mention the one-liner you got from another thread: what is not working, are you getting an error or just unexpected results, are you inputting the MAC manually or pulling it from a machine? The answer to all these questions, along with a reproducer of what you're trying to do, will go a long way in helping us help you ;)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I wanna make a filter for the input box

So, wanna acept in the input only Hexadecimal with mask format.

Im using, for mask (write by PhoenixXL):

'?do=embed' frameborder='0' data-embedContent>>

Now need use, maybe (write by Melba23):

'?do=embed' frameborder='0' data-embedContent>>

 

But i dnt know how join both code. Sry for my english. Thz

Edit: wanna input manually the MAC code. Example, i wanna write: AA00AA00AA00 and show: AA-00-AA-00-AA-00 (did with format by PhoenixXL) and only accept Hexadecimal (so if write W then not write, maybe need use the Melba23 code)

Edited by editcheck
Link to comment
Share on other sites

  • Solution

So basically you want

$str = "AA00AA00AA00"
 

1. Check if the input string are hex chars: StringIsXDigit($str)

2. Every two chars add a "-": StringRegExpReplace($str,'[0-9A-Fa-f]{2}','$0$1-$2',5)

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
Share on other sites

thz kyan the

2. Every two chars add a "-": StringRegExpReplace($str,'[0-9A-Fa-f]{2}','$0$1-$2',5)

is crashing, i dnt know why.

solve with:

If(Not StringIsXDigit(StringReplace($s_Text, '-', ''))) Then $s_Text = StringTrimRight($s_Text, 1)
$s_Text = StringRegExpReplace($s_Text, "(-|^)([^\-]{" & $iMinChars & "})([^\-])", "\1\2-\3")
Edited by editcheck
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...