# A dialog to get string to be replaced
$startValue = Read-Host "
Enter a prefix string, for example '_', then press Enter; If empty, use '_' as the default value"
if ($startValue -eq "") {
    $searchString = '_'
}else{
    $searchString = $startValue;
}

# A dialog to get string to replace
$inputValue = Read-Host "
Enter a string to replace '$searchString', for example 'ax-', then press Enter"

# Confirm replacement
$response = Read-Host "
Are you sure you want to replace '$searchString' with '$inputValue'?
If you are sure, please enter 'Y/y' and press Enter; otherwise, enter 'N/n' and press Enter"

if ($response -eq "Y") {
    # Result: "_btn" => "ax-btn"

    $replaceString = $inputValue

    # Get all CSS and LESS files
    $files = Get-ChildItem -Path '.\styles' -File -Recurse

    # Perform replacement operation on each file individually
    foreach ($file in $files) {
        # Get
        $content = Get-Content -Path $file.FullName -Raw
        
        # Replace
        $newContent = $content -replace [Regex]::Escape($searchString), $replaceString
        
        # Fill
        Set-Content -Path $file.FullName -Value $newContent
    }
}
