How do I make a regular expression?

Antrax - SIM-Group settings

<span style="font-size: 13.3333px;">How do I make a regular expression?</span><br style="font-size: 13.3333px;">

Parsa JAVA<br>https://www.freeformatter.com/java-regex-tester.html<br><br>Examples from ANTRAX:<br><br>1. Parse the response string of the balance check using the regular expression. In this case, you need to get the expression '2.00'<br><br>Full post:<br><br>Na Vashem schete 2.00 grn. Tarif 'Vodafone Light'. Nomer deystvitelen do 01/07/2019. Upravlyaite nomerom v My Vodafone App - www.vodafone.ua<br>In order to compare a certain value, you must first capture the entire message and then use the regular expression to specify what it is necessary to compare.<br><br>To do this, you must select a word or a phrase before the value or after, you can also specify both to have a more accurate regular expression to be compared, precede it with ". *", Given the "spaces" before the value that needs to be checked, numeric value, for this we use \ d, in order to take several numbers it is necessary after specifying \ d + if the value is "." or ",", then you need to escape them with the "\" symbol, it will look like "\." or "\,", then we specify the values that follow, it can be characters that can be taken with ". *" or numbers that can be taken with "\ d +", but after the characters "." or "," it is desirable to specify the exact value of numbers, you can use "\ d" with the additional values "{}" - this setting is responsible for the number of characters to be taken for the regular expression, respectively, . " goes 2 numbers it is necessary in parentheses "{}" to specify 2, that is \ d {2}. Also, if you need to make a comparison, the value that you want to compare must be in brackets "()", these regular expressions will look like this (\ d +) and (\ d {2}). It also happens sometimes that the message has a line break that also needs to be specified with "(? S)". After the regular expression for comparison 2.00 will look like the example below:<br><br>. * Na Vashem schete (\ d +) \. (\ D {2}) grn. * (? S). *<br>Consider this regular expression:<br><br>The value ". *" Is responsible for selecting all the characters in the given line<br><br>"Na Vashem schete" is a phrase that is before the value 2.00, that is, we made a binding to the value 2.00, indicating the word before it<br>(\ d +) is a regular expression for the value 2 from the number 2.00<br>\. is a regular expression for a value. from the date 2.00<br>(\ d {2}) is a regular expression for the value 00 from the number 2.00<br>"grn" is a phrase that is after the value 2.00, that is, we made a binding to the value 2.00, indicating the word after it<br><br>. * (? s). * is a regular expression. which is responsible for the possible transfer of a line, is necessary for the fact that if the message is with line wrapping<br>Sometimes messages are different with or without a transfer and in order to avoid creating two regular expressions, the possible transfer of a line is indicated.<br><br>2. Parse the answer line of the balance check when getting Hebrew.<br><br>Full post:<br><br>ستاسو فعلی حساب 0.00 افغانی اوتر 07/07/2018 اعتبارلری<br>Regular expression:<br><br>. * (\ d +) \. (\ d {2}) * (? s). *<br>3. Parse the string for auto-replacement sms, if you need to replace one expression. In this example, you need to replace the 'confirmation code:'<br><br>In order to replace the text with SMS, it is also necessary to select the whole message and then split it into parts, those that do not need to be changed, they can be specified as ". *" And those that need to be replaced, you need to specify a word or a phrase<br><br>Full post:<br><br>Enter your confirmation code: 558877<br>Regular expression:<br><br>(.*)(confirmation code)(.*)<br>Where:<br><br>The regular expression (. *) is responsible for the phrase "Enter your personal" - the first part of the message<br><br>(confirmation code) is a regular expression that is responsible for the exact phrase "confirmation code"<br>(. *) is a regular expression that is responsible for the phrase ": 558877"<br>That is, we divided the text of the message into 3 parts:<br><br>1 part to the words "confirmation code"<br><br>2 part of the word "confirmation code"<br><br>Part 3 after the words "confirmation code"<br><br>Each part of the expression acts as a "part" - where the "part" is the ordinal number of the pair "()", that is, the first open "(" (bracket), will be as $ 1, the next "(" (bracket) as $ 2<br><br>In the Replace by field, specify:<br><br>$ 1 $ 3<br>Result of replacement:<br><br>Enter your personal: 558877<br>4. parsing the line for auto-replace sms, if you need to replace multiple expressions. In this case, you need to replace G-, google, code.<br><br>Full post:<br><br>G-679425 is your google verification code<br>Regular expression:<br><br>(G \ -) (. *) (Google) (. *) (Code)<br>In the Replace by field, specify:<br><br>$ 2 $ 4 Code<br>Result of replacement:<br><br>679425 is your verification<br>Where,<br><br>. * matches any character (except row terminators);<br>(\ d) - match with a digit (equal to [0-9]);<br>(\ d +) - match with any number of digits;<br>(\ d {2}) - matches exactly 2 times;<br>\. - Shielding the character;<br>(? s) - wrapping the line.


 


Loading...