1. P

    Convert camelCase to dash-case (hypens) in pure ruby

    There are plenty of posts about the opposite way. But how to I convert camelCase to camel-case in ruby? My regex-game is pretty low ... here is it the other way around: def underscore(string) string.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2')...
  2. S

    Regex to find String with square bracket and replace

    My current Code is ` String text= "[School_Teacher_Name] is our new member, So please congratulate [School_Teacher_Name] ."; String tag = "[School_Teacher_Name]"; String value= "Yash Mathur"; String str1 = tag.substring(1, tag.length()-1); String reg = "/\\["+str1+"\\]/"...
  3. T

    Java regex behaving wierd

    I have the below test case, @Test public void test_check_pattern_match_caseInSensitive_for_pre_sampling_filename() { // given String pattern = "Sample*.*Selection*.*Preliminary"; // when // then...
  4. P

    PHP Regex - how to remove string after “Newline * regards”

    I've got strings like the following: Hi X Blah Kind regards ABC And Hi X Blah Regards CBA So the key is the newline and the word "regards" (case insensitive). I'd like to use PHP to get the part of the string before the line that contains "regards". E.g. for these examples, the result...
  5. A

    Regular epxression (sass variables)

    (Node.js) I have to match all Sass variables from file. But I can have variables and mixins in one file. I need to update regular epxression to not match a variables from mixin directive or from mixin / function content (nested). So only: $test: true; $white: #fff !default; $sizes: (25...
  6. D

    Extract specific XMLs from log file

    I have large log files (around 50mb each), which contain java debug information plus all kinds of XML responses Here's an example of something I'm trying to extract from the log <envelope> <response> <ATTR name="uniqueid" value="XYZ_00000-00-00_12345_1"/> <ATTR name="status"...
  7. K

    Remove every character from a string except the numbers and characters between them

    The problem I'm facing is that I'm unable to get number from a string along with dot or comma between those numbers. Example string: 'kr.2.000,00 DKK' OR '$150.65 USD' OR '€340.00 EUR' From this string I need to fetch '2.000,00' using regex. so basically the regex would be to fetch numbers and...
  8. U

    REGEX That Doesn't Allow Spaces or Special Characters

    Salutations, I need a regular expression in which doesn't allow spaces or special characters. All replies are appreciated. Thank you. For example, if somebody enters $cdIAb!%, a bcd, or $ab%c d@, it would be rejected. If they entered cdIAb it would be accepted. This is for an Xenforo forum.