Some lines of a file:
2e72 7372 6300 0000 8c04 0000 00e0 1a00
0010 0000 00d0 1a00 0000 0000 0000 0000
0000 0000 4000 0040 2e72 656c 6f63 0000
0c00 0000 0000 1b00 0010 0000 00e0 1a00
Is there a way to transform it in readable characters?
Yes, it is possible. You could try a plugin like this: https://www.sublimetext.com/forum/viewtopic.php?f=5&t=3728
I'm sure there are others out there, but this is what I found with a quick Google search. Just look for "hex to ascii plugin sublime" or something like that. Also, check out this related question.
Related
I am trying to create a regex that detect if a string of hexadecimal is only a combination of 00 , 06, 03 and space.
The closest i've found so far is ^(00|06|03)$ but it's still giving me false for 0300
0300 will match
0600 0300 match
0612 0300 no match
3030 no match
^(00|06|03)$ will only match '00' or '06' or '03'. If you're expecting this combination to repeat, you need to add +.
Try ^(00|06|03| )+$
I've included the space in there as well. This will match your scenarios.
Close, but you need closure and some safe-guarding:
let v = /^((00|06|03){2}\s)*(00|06|03){2}$/;
[
'0300',
'0600 0300',
'0612 0300',
'3030',
'0303 0000',
'0630 0300',
'8790 0060',
'03 0000',
'0003 0006 0000 0000 0303 0606 0600 0306 0000',
'0606 0603 0303'
].map(s => console.log("%s : %s", s, v.test(s)));
62020180327 00000000000344753973KOLESTON PERF.CAST.MD RAME 4/4PZ2222302620ECU0000073800000099800000000000000000000000000000000 0000 22 2200 KOLESTON
62020180327 00000000000353753976KOLESTON PERF.CAST.CH.DOR. 5/3PZ2222302620ECU0000073800000099800000000000000000000000000000000 0000 22 2200 KOLESTON
62020180327 00000000000357189272KOLESTON PERFECT 5/7 PZ2222302620ECU0000066900000089500000000000000000000000000000000 0000 22 2200ESKOLESTON
62020180327 00000000000373189267KOLESTON PERFECT 7/3 PZ2222302620ECU0000066900000089500000000000000000000000000000000 0000 22 2200ESKOLESTON
hi, I've a list like this one. How could i delete/remove the lines containing the characters ES at postion 141?
Thanks for helping!
Here is the general approach:
Replace this: ^.{140}ES.*(\r?\n|$) with empty string.
Explanation:
^.{140} matches the first 140 characters from the start of the line
ES is the exact match you need
.*(\r?\n|$) matches everything else, including the line break too.
So when you replace everything, including the line break too, then the line disappears. I.e. it doesn't even leave a blank line behind.
I have this Regex to validate Visa and Master card with spaces, it works perfect.
^(?:4\d{3}|5[1-5]\d{2}|6011|3[47]\d{2})([- ]?)\d{4}\1\d{4}\1\d{4}$
Visa
4111111111111111 = true
4111 1111 1111 1111 = true
Master
5500000000000004 = true
5500 0000 0000 0004 = true
American Express
340000000000009 = false
3400 0000 0000 009 = false
I need add Amex to the regex, I need the last two true, can anyone help me please?
Thank you!
(assuming 4111111111111111 = false is a typo)
You can use the following regex :
^(?:4\d{3}|5[1-5]\d{2}|6011|3[47]\d{2})([-\s]?)\d{4}\1\d{4}\1\d{3,4}$
see demo
I do not know the background how you use this regex but i would do this in two steps:
Step 1:
Remove all spaces with one line of code. Since spacing should not define whether a number is valid/invalid.
Step 2:
Use this regex
^(?:4[0-9]{12}(?:[0-9]{3})?|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13})$
This catches a few more rules on MasterCards.
Source (Shortend expression since fewer types of cards are needed)
Demo
I have a small test to match using regex.
Match to true if and only if user has entered "0000" or 000 or 00 or 0.
0001 or 0011, 1000, 0111, 1111 should return false.
Here is what i have tried : /^0*([0]{1,4})/ but it didn't work.
This should work just fine:
/^0{1,4}$/
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Ok so Im a bit lost on this. So looking at a this 0 0 0 0 and looking at each 0 individually with each one has a probability of 0.01 of turning from a 0 to a 1
Ok so there are 4 numbers each number can be a 0 or a 1
Probability is measured by determining how likely an event is to happen divided by the number of possible outcomes
The possible outcomes are:
0000
0001 0010 0100 1000
1100 1001 1010 0101 0011 0110
1110 0111 1011 1101
1111
So there is a total of 16 possible outcomes or 4^2 i.e. 4 number by the possible outcomes they can be 0 or 1
So the probability of the string of number to be to turn from 0000 to 1111 would be
0.01/16
The probability of the number to be from 0000 to 0100 would also be
0.01/16?
And the probability of all the number to stay the same would i.e 0000 to 0000
would still be 0.01/16
It kinda makes sense but I don't know would all of them be the same probability?
Or am I doing this wrong
so each number has a 0.01 chance to change so for the string to go from 0000 to 1111 would be 0.01 *4 / 16 or 0.0025
And the chance to change from 0000 to 0100
would be 0.01 * 1 /16
And to change from 0000 to 0000 would be
0.01*0 /16
Thanks for any help with this
There are two things here. One, the number of possible outcomes (16) and the probability of each outcome.
Since the probability of a single bit being flipped to 1 is skewed towards it being 0, then the distribution of outcome probabilities is not even. If there was a 50% chance of a 1 or a 0 in each spot, then the probability of each of the 16 outcomes would be 1/16. That is not the case here.
The approach I'd take is to group the numbers into buckets. Of the 16 outcomes, 1 has zero 1's, 4 have one 1, 6 have two 1's, 4 have three 1's, and 1 has four 1's.
The probability of four 0's is 99%^4. The probablity of one 1 is 1% x 99%^3. The probability of 2 is 1%^2 x 99%^2. etc. Calculate each of the probabilities , then divide by the size of the bucket. Add them up, and they should equal 100% (sanity check).
I checked it in a spreadsheet, and the results seem good:
Outcome Probability
0000 0.96059601
0001 0.00970299
0010 0.00970299
0100 0.00970299
1000 0.00970299
0011 0.00009801
0101 0.00009801
1001 0.00009801
0110 0.00009801
1010 0.00009801
1100 0.00009801
0111 0.00000099
1011 0.00000099
1101 0.00000099
1110 0.00000099
1111 0.00000001
You state that the probability of a zero changing to one is .01 (I'm inferring then .99 of no change)
The Overall probability is the product of single probabilities then:
Lets do a simple case:
0000 to 1111
(.01) * (.01) * (.01) * (.01) = (.01)^4 = .00000001
0000 to 0100
(.99) * (.01) * (.99) * (.99) = (.99)^3 * (.01) = .00970299
So they don't have the same probability