Java Regex

In this post, you will learn Java REGX and its example.

regular expression defines a pattern for a String. Regular Expressions can be used to search, edit or manipulate text. Regular expressions are not language specific but they differ slightly for each language. 

Here are some rules to be followed while creating a regular expression.







E.g.

Regular expression for validating the email id is:

^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$


^ // start of the line
[_A-Za-z0-9-\\+]+ //   must start with string in the bracket [ ], must contains one or more (+)
( //      start of group #1
  \\.[_A-Za-z0-9-]+ //     follow by a dot "." and string in the bracket [ ], must contains one or more (+)
)* //     end of group #1, this group is optional (*)
  @ //     must contains a "@" symbol
   [A-Za-z0-9-]+              //     follow by string in the bracket [ ], must contains one or more (+)
    ( //      start of group #2 - first level TLD checking
     \\.[A-Za-z0-9]+   //      follow by a dot "." and string in the bracket [ ], must contains one or more (+)
    )* //       end of group #2, this group is optional (*)
    ( //       start of group #3 - second level TLD checking
     \\.[A-Za-z]{2,}           //       follow by a dot "." and string in the bracket [ ], with minimum length                                                    of 2
    ) //       end of group #3
$         //       end of the line


Exporting and Importing Metadata files in Oracle Identity Manager


1.      Go to $OIM_ORACLE_HOME/server/bin.
(Set $OIM_ORACLE_HOME= /home/oracle/Oracle/Middleware/Oracle_IDM1)

2.      Edit the weblogic.properties file.

3.      To Export file change the following fields.

wls_servername=oim_server1
application_name=OIMMetadata
metadata_from_loc=@From_location
metadata_to_loc=<path where to export>
metadata_files=<relative path to file>

4.      Then run ./weblogicExportMetadata.sh
Username= weblogic
Password= (your password)
URL: t3://Host:port (e.g. t3://host:14000)


5.      Then again to import change following fields in weblogic.properties.

wls_servername=oim_server1
application_name=OIMMetadata
metadata_from_loc=”path from where to import”
metadata_to_loc=@To_location

metadata_files=<file name>

For importing you have to give the path from where you want to import the file