Skip to content

Instantly share code, notes, and snippets.

@scottfrazer
Created March 9, 2011 20:03
Show Gist options
  • Save scottfrazer/862880 to your computer and use it in GitHub Desktop.
Save scottfrazer/862880 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class test
{
public static void main(String[] args)
{
String input;
System.out.println("Hello, welcome to the forum. Input your post");
Scanner k = new Scanner(System.in);
input = k.nextLine();
input = input.replaceAll("([^A-Za-z])[dD][oO][gG]([^A-Za-z])","$1!@#$2");
input = input.replaceAll("^[dD][oO][gG]([^A-Za-z])","!@#$1");
input = input.replaceAll("([^A-Za-z])[dD][oO][gG]$","$1!@#");
System.out.println("Your thread has been posted");
System.out.println(input);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment