Regular Expression rules


The syntax for the REGEXP_SUBSTR function in Oracle is:

REGEXP_SUBSTR( string, pattern [, start_position [, nth_appearance [, match_parameter [, sub_expression ] ] ] ] )

Parameters or Arguments

The string to search. It can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.
The regular expression matching information. It can be a combination of the following:

^Matches the beginning of a string. If used with a match_parameter of ‘m’, it matches the start of a line anywhere within expression.
$Matches the end of a string. If used with a match_parameter of ‘m’, it matches the end of a line anywhere within expression.
*Matches zero or more occurrences.
+Matches one or more occurrences.
?Matches zero or one occurrence.
.Matches any character except NULL.
|Used like an “OR” to specify more than one alternative.
[ ]Used to specify a matching list where you are trying to match any one of the characters in the list.
[^ ]Used to specify a nonmatching list where you are trying to match any character except for the ones in the list.
( )Used to group expressions as a subexpression.
{m}Matches m times.
{m,}Matches at least m times.
{m,n}Matches at least m times, but no more than n times.
\nn is a number between 1 and 9. Matches the nth subexpression found within ( ) before encountering \n.
[..]Matches one collation element that can be more than one character.
[::]Matches character classes.
[==]Matches equivalence classes.
\dMatches a digit character.
\DMatches a nondigit character.
\wMatches a word character.
\WMatches a nonword character.
\sMatches a whitespace character.
\Smatches a non-whitespace character.
\AMatches the beginning of a string or matches at the end of a string before a newline character.
\ZMatches at the end of a string.
*?Matches the preceding pattern zero or more occurrences.
+?Matches the preceding pattern one or more occurrences.
??Matches the preceding pattern zero or one occurrence.
{n}?Matches the preceding pattern n times.
{n,}?Matches the preceding pattern at least n times.
{n,m}?Matches the preceding pattern at least n times, but not more than m times.
Optional. It is the position in string where the search will start. If omitted, it defaults to 1 which is the first position in the string.
Optional. It is the nth appearance of pattern in string. If omitted, it defaults to 1 which is the first appearance of pattern in string.
Optional. It allows you to modify the matching behavior for the REGEXP_SUBSTR function. It can be a combination of the following:

‘c’Perform case-sensitive matching.
‘i’Perform case-insensitive matching.
‘n’Allows the period character (.) to match the newline character. By default, the period is a wildcard.
‘m’expression is assumed to have multiple lines, where ^ is the start of a line and $ is the end of a line, regardless of the position of those characters in expression. By default, expression is assumed to be a single line.
‘x’Whitespace characters are ignored. By default, whitespace characters are matched like any other character.
Optional. This is used when pattern has subexpressions and you wish to indicate which subexpression in pattern is the target. It is an integervalue from 0 to 9 indicating the subexpression to match on in pattern.


The REGEXP_SUBSTR function returns a string value.
If the REGEXP_SUBSTR function does not find any occurrence of pattern, it will return NULL.


  • If there are conflicting values provided for match_parameter, the REGEXP_SUBSTR function will use the last value.
  • If you omit the match_behavior parameter, the REGEXP_SUBSTR function will use the NLS_SORT parameter to determine if it should use a case-sensitive search, it will assume that string is a single line, and assume the period character to match any character (not the newline character).
  • See also the SUBSTR function.

Increase space Virtual Box and Linux Partition

Clone the disk

VBoxManage clonehd “path/WebServer.vmdk” “path/WebServer.vdi” –format vdi

resize 20*1024 = 20GB

VBoxManage modifyhd “path/WebServer.vdi” –resize 20480

reconvert into vmdk

VBoxManage clonehd “path/WebServer.vdi” “path/WebServer.vmdk” –format vmdk

File -> Virtual Media Manager -> Removed existing images (note, I removed them only from the registry).

1. Open the Oracle VM VirtuaBox Manager
Click on File -> Virtual Media Manager (or Ctrl+D)
2. Delete the hard disk entry in question (select and press “Del” on keyboard)
3. Open “Settings” of the Virtual Machine, go to “Storage”, click “Add Attachment”, select “Add Hard Disk” and “Choose existing disk“, then selected the vdi file and you are done.

  1. Download “gparted-live-x.xx.x-x-ixxx.iso” file from Mount this iso file as CD. Virtual Machine -> Settings -> Storage -> Controller IDE (Right Click) -> Add CD/DVD -> Select gparted-live-x.xx.x-x-ixxx.iso file
  2. Run virtual machine, Virtual Machine will boot from this CD. Choose default values with pressing “Enter”, “Enter” … until Gpart ISO GUI starts. Select tool gpart program and start.
  3. Extend disk size as below;
    • Right click on partitions and if “possible” click on “Disable Active Partion”.
    • Extend Partition as much as possible from GUI (for this case 500GB).
    • Right click the partition which is disabled and select “Enable Active Partion”.
    • Apply and wait until the operations finished.
    • Shut down virtual machine.
    • Unmount gparted-live-x.xx.x-x-ixxx.iso.
      $ Virtual Machine -> Settings -> Storage-> Controller IDE (Right Click on gparted-live-x.xx.x-x-ixxx.iso) -> Remove Attachement
    • Start the virtual machine.


df -h

File system              Dim. Usati Dispon. Uso% Montato su
/dev/mapper/centos-root   19G  6,2G     13G  34% /
devtmpfs                 910M     0    910M   0% /dev
tmpfs                    920M     0    920M   0% /dev/shm
tmpfs                    920M  8,6M    912M   1% /run
tmpfs                    920M     0    920M   0% /sys/fs/cgroup
/dev/sda1               1014M  188M    827M  19% /boot
tmpfs                    184M     0    184M   0% /run/user/0


resize2fs /dev/mapper/centos-root

lvextend -l+100%FREE /dev/mapper/centos-root

resize2fs /dev/mapper/centos-root

xfs_growfs /dev/mapper/centos-root

df -ha

WildFly(JBoss) vs. Tomcat

Both WildFly and Tomcat are Java application servers, but they have difference strength. Making the wrong choice can result in more work than necessary.

The JBoss application server (aka JBoss AS) is an application server based on Java. It is an open source software server and is usable in any operating system supported Java (because the server is Java based).

Apache Tomcat is a servlet container (meaning it is a Java class that operates under the strictures of the Java Servlet API – a protocol by which a Java class responds to an http request). This is an open source server, providing a ‘pure Java’ HTTP web server environment in which code written in Java is capable of running.

The major difference between Wildfly and Tomcat
Both JBoss and Tomcat are Java servlet application servers, but JBoss is a whole lot more. The substantial difference between the two is that JBoss provides a full Java Enterprise Edition (JEE) stack, including Enterprise JavaBeans and many other technologies that are useful for developers working on enterprise Java applications.

Tomcat is much more limited. One way to think of it is that JBoss is a JEE stack that includes a servlet container and web server, whereas Tomcat, for the most part, is a servlet container and web server.

On the other hand, Tomcat has a lighter memory footprint (~60-70 MB), while those Java EE servers weigh in at hundreds of megs. Tomcat is very popular for simple web applications, or applications using frameworks such as Spring that do not require a full Java EE server. Administration of a Tomcat server is arguably easier, as there are fewer moving parts.

When WildFly
JBoss is the best choice for applications where developers need full access to the functionality that the Java Enterprise Edition provides and are happy with the default implementations of that functionality that ship with it. If you don’t need the full range of JEE features, then choosing JBoss will add a lot of complexity to deployment and resource overhead that will go unused. For example, the JBoss installation files are around an order of magnitude larger than Tomcat’s.

When Tomcat
Tomcat is a Java servlet container and web server, and, because it doesn’t come with an implementation of the full JEE stack, it is significantly lighter weight out of the box. For developers who don’t need the full JEE stack that has two main advantages.

Significantly less complexity and resource use.


For those who need add-ons that work with Tomcat, there are some lightweight alternative to JEE like EJB.

WildFly is a application servers with access to the whole JEE stack while Tomcat is servelet server

Developers of complex Java enterprise applications should choose JBoss (or GlassFish), while those who don’t need the full JEE stack are better off with Tomcat plus any extensions they need.

JBoss makes use of the Java EE specification; Tomcat makes use of Sun Microsystems specific specifications.


JBoss vs. Tomcat: Choosing A Java Application Server

Difference Between JBoss and Tomcat


How to Evaluate the Performance (CPU + Memory) of java Software:

java -cp “.:../lib/*:../../../../lib/*” it.AppListener > /var/log/AppListener.log 2>&1 &

export JAVA_OPTS=”-server -Xms6144M -Xmx7168M”

after set the port variable during the start up of the software, is possible to use to evaluate the situation this software

Linux command to check which process takes memory

ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | sort -n


Where to download VisualVM