Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts

Friday, January 17, 2014

[JAVASCRIPT/JQUERY] How to remove html tags from that source.

How to remove html tags from that source.

core source
HTMLVALUES.replace(/<(\/)?([a-zA-Z]*)(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi,'')


using jquery button event
$('#stripTags').click(function(){
 $('textarea[name="strReplace"]').val($('textarea[name="strReplace"]').val()
  .replace(/<(\/)?([a-zA-Z]*)(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi,'')
 return false; 
});

Friday, October 5, 2012

[JAVA] Java Split Function, Examples









JAVA FUNCTION - SPLIT


Is a function that returns an array of strings by regular expressions.
Second parameter limit the value to the number of options you can control.

public String [] split(String  regex, int limit)


Special character
String str="1+2+10+15";
String splitted[]=str.split("[+]");
for (String value : splitted)
 System.out.println(value);

// RESULT
// 1
// 2
// 10
// 15


Blank value
String str="1,,3,";

String splitted[]=str.split(",");
for (String value : splitted)
 System.out.println(value);
// RESULT
// 1
// 3

String splitted[]=str.split(",",-1);
for (String value : splitted)
 System.out.println(value);

// RESULT
// 1
// 
// 3
//

Friday, September 7, 2012

[TOOL/EDITPLUS] EDITPLUS REGULAR EXPRESSION REPLACE EXAMPLES


first you check the 'Regular expression' option



remove whitepsace of end-of-lines
Find what: ( *)$
Replace with: none

remove whitespace at start each lines
like this codes:
<script src..............
  if(value){
    document.write()
after replace
<script src..............
if(value){
document.write()
Find what: ^([0-9]+ +)
Replace with: none

remove lines has only whitespace or null
Find what: ( *)\n\n
Replace with: none

searching html tag name
Find what: (\<\/?[A-Z]+)