Regular expression to remove special characters in JSTL tags

The JSTL fn:replace() does not use a regular expression based replacement. It’s just an exact charsequence-by-charsequence replacement, exactly like as String#replace() does. JSTL does not offer another EL function for that. You could just homegrow an EL function yourself which delegates to the regex based String#replaceAll(). E.g. package com.example; public final class Functions { private … Read more

Powershell script to remove double quotes from CSV unless comma exists inside double quotes

Adapting the code from “How to remove double quotes on specific column from CSV file using Powershell script”: $csv = ‘C:\path\to\your.csv’ (Get-Content $csv) -replace ‘(?m)”([^,]*?)”(?=,|$)’, ‘$1’ | Set-Content $csv The regex (?m)”([^,]*?)”(?=,|$) is matching any ” + 0 or more non-commas + ” before a comma or end of line (achieved with a positive look-ahead … Read more

Multiline Regex in PowerShell

Get-Content produces an array of strings, where each string contains a single line from your input file, so you won’t be able to match text passages spanning more than one line. You need to merge the array into a single string if you want to be able to match more than one line: $text = … Read more