regex

Replacing part of string while leaving the rest intact with Notepad++

I’m trying to edit a huge file with lines like: 1 9416 0 0 10 10 0 dropitems.drop_MFighter_m012_t91_u_m00 mfighter.MFighter_m201_t201_u 0 0 0 0 0 1 0 0 icon.armor_t91_u_i00 -1 7570 46 1 2531A298 0 1 21 1 Fighter.MFighter_m201_u 1 mfighter.MFighter_m201_t201_u 2 Fighter.MFighter_m201_hrh_ad00 104 114 Fighter.MFighter_m201_hrs_ad00 115 114 2 MFighter.MFighter_m201_HRR_ad00_t201_a MFighter.MFighter_m201_HRR_ad00_t201_a 1 Fighter.FFighter_m012_u 1 FFighter.FFighter_m012_t201_u 2 Fighter.FFighter_m012_hrr_ad00 114 114 Fighter.FFighter_m012_hra_ad00 97…
Read more

Regex not matching input

I have no idea why the following returns false: “HELLO [#1]”.matches(“[#.+?]$”) The same regex does match in other languages. Anyone could explain this? Source: regex

Python, regexp parse #define from C

How can I get all information from #define from C file thanks to Python and regular exp. I need to get [‘#define’, ‘macro_name’, ‘value’] from: #define MACRO 5 // comment I want to consider also multi line macroes like: #define MACRO 5 // comment My test: ‘(#define)s+(‘ + _codename + ‘)s*(\)*s*(w*)’ But only one line is working for me with:…
Read more

PHP (Regex) Check if a string contains at least 4 digits + 2 letters

I would check a string if contains at least: 2 letters (a-z) CASE INSENSITIVE 4 digits (0-9) the order is not important. It could be a1234b, abcd1234, 4444aa etc etc. My actual regex is if (preg_match(“/[a-z][^a-z]*[a-z]*[0-9]/i”,$string)) { echo ‘secure’; $continue = true; } and it doesn’t function if string start with a digit. Thank you Source: regex

Using a variable in sed search pattern when the value of the variable contains square brackets

What I’m trying to do is check that a file has been created. The best way I can think to do this is by listing the files before hand, listing them afterwards, deleting the before list from the after list, then seeing if the after list is not zero. I ran into trouble deleting the before list from the after…
Read more

Add [] around numbers in strings

I like to add [] around any sequence of numbers in a string e.g “pixel1blue pin10off output2high foo9182bar” should convert to “pixel[1]blue pin[10]off output[2]high foo[9182]bar” I feel there must be a simple way but its eluding me 🙁 Source: regex

PHP OPcache crashes when having multiple patterns in blacklist file

I have OPcache configured in my php.ini file as follows: [opcache] zend_extension=”C:xampp-5.6phpextphp_opcache.dll” opcache.enable=1 opcache.memory_consumption=128 opcache.interned_strings_buffer=64 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1 opcache.save_comments=0 opcache.load_comments=0 opcache.blacklist_filename=”C:xampp-5.6phpcfgopcache.blacklist” If there is just one file pattern inside the blacklist file, everything works fine. But as soon as I add another file pattern for another directory, Apache aborts the startup process and OPcache emits the following error message:…
Read more

PHP reguler expression start and end with given strings

I have a string like this 05/15/2015 09:19 PM pt_Product2017.9.abc.swl.px64_kor_7700 I need to select the pt_Product2017.9.abc.swl.px64_kor from that. (start with pt_ and end with _kor) $str = “05/15/2015 09:19 PM pt_Product2017.9.abc.swl.px64_kor_7700”; preg_match(‘/^pt_*_kor$/’,$str, $matches); But it doesn’t work. any idea? Source: regex