Trying to extract String using pattern
I need to get exact link to image (src value) and alternate text (alt).
HTML, where this image is situated can be:
<IMG class=simple_img height=124 alt="*FirstName LastName MiddleName*" hspace=0 src="/images/7c/6c/d782a19f2f156713a2647dee1fe2.*jpeg*" width=100 align="left" border=0>
or
<IMG class="*simple_img*" height=124 alt="*FirstName LastName MiddleName*" hspace=0 src="/images/7c/6c/d782a19f2f156713a2647dee1fe2.*gif*" width=100 align="left" border=0>
or
<IMG class="*simple_img*" height=124 alt="" hspace=0 src="/images/7c/6c/d782a19f2f156713a2647dee1fe2.*jpeg*" width=100 align="left" border=0>
or
<IMG class=*simple_img* height=124 alt="" hspace=0 src="/images/7c/6c/d782a19f2f156713a2647dee1fe2.gif" width=100 align="left" border=0>
1.My image has class="simple_img", but it can be in "" or without them. Only my image can have such class.
2.It can be gif or jpeg
3.Sometimes alt is empty.
It's great if alt exists, but if it is not, anyway, I need src.
I've wrote regular experession:
private static final String personImagePattern ="\"*simple_img\"*.*alt=\"(.*)\".*src=\"(/images/.*\\.gif|\\.jpeg)\"";The problem is, that my regular expression doesn't match
1. jpeg images
or
2. images with class="simple_img" (" quotes are used ")
3. empty alt="" attribute
4. Mixture of cases 1,2,3
Please, tell me, what's wrong with my regexp?
I've wrote *\"** it means that " can appear or not before and after simple_img
I've wrote \\.gif|\\.jpeg)\" it means .gif or .jpeg can appear.
Here are sample, which haven't matched:
{code}
<IMG class=simple_img height=150 alt="" hspace=2 src="/images/58/19/ee4d0bc5818061771cad1b89308d.gif" width=100 align="left" border=0>
<IMG class=simple_img height=180 alt="FirstName LastName MiddleName" hspace=2 src="/images/29/89/c69a344707cbab3d6c0c06271b25.jpeg" width=140 align="left" border=0>
<IMG class=simple_img height=132 alt="" hspace=5 src="/images/00/0e/5dd91f68c7302880c3a506b263ed.jpeg" width=100 align="left" border=0>
{code}
Please, help.
Edited by: Holod on 11.09.2008 7:20
I've modified my regexp:
private static final String personImagePattern ="simple_img.*alt=\"(.*)\".*src=\"(/images/.*\\..+)\".*width";No it captures everything I need, exept case, when alt="", I mena when alt attribute is empty.
I've wrote lt=\"(.*)\". .* tells that something or nothing could be inside quotes of alt attribute.
What Am I doing wrong?
Similar Messages
-
Extracting strings from binary data
Hello,
I am trying to extract string from a binary file.
At the unix command line (sunos) I can just type;
strings <filename>
This is a nice way to get a list of the contents of a directory.
Is there a way in pl/sql to extract strings from binary data ? An equiv to strings on unix/linux ?
Thanks in advance.
BenHi,
If you do want to list the contents of a directory, there are other ways to do it. Here's a base implementation of a utility I wrote:
create or replace and resolve java source named "Util" as
import java.io.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
public class Util {
public static void listFiles(String directory, oracle.sql.ARRAY[] names)
throws IOException, SQLException {
File f = new File(directory);
if(f==null)
throw new IOException("Directory: "+directory+" does not exist.");
String[] files = f.list(
new FilenameFilter() {
public boolean accept(File dir, String name) {
// List all files
return true;
Connection conn = new OracleDriver().defaultConnection();
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("VC_TAB_TYPE", conn);
names[0] = new ARRAY(descriptor, conn, files);
return;
create or replace type vc_tab_type is table of varchar2(255);
create or replace package util authid current_user as
function list_files(p_directory in varchar2)
return vc_tab_type;
end;
create or replace package body util as
procedure list_files (
p_directory in varchar2
, p_filenames out nocopy vc_tab_type
is
language java
name 'Util.listFiles(java.lang.String, oracle.sql.ARRAY[])';
function list_files(p_directory in varchar2) return vc_tab_type
is
l_filenames vc_tab_type := vc_tab_type();
begin
list_files(p_directory, l_filenames);
return l_filenames;
end;
end;
/You can then query the filesystem as follows:
1 select column_value as filename
2 from table(util.list_files('c:\windows'))
3 where column_value like '%.log'
4* and rownum <= 10
SQL> /
FILENAME
0.log
AdfsOcm.log
aspnetocm.log
bkupinst.log
certocm.log
chipset.log
cmsetacl.log
comsetup.log
DtcInstall.log
FaxSetup.log
10 rows selected.cheers,
Anthony -
Extract the numbers in string using regex
Hi,
How to extract the numers in string using regex?.
Already i tried split up the string using [\\s]
For ex: "Uting Tatk and Window Panet 15"
it gives the ans 15.
if the string is
For ex: "Uting Tatk and Window Panet 15 New!"
i can't find the number.
so plz give me some idea to get the number frm String.
ThanksI am developing a java project to extract Table of
content in a particular
PDF.
i extracted all topics.
then i want 2 extract page number from dat extracted
TOC.
if the TOC ends with number then i can easily find
out the number
but in vain if the TOC ends with like this
"Uting Tatk and Window Panet 15 New!".
i could n't find the page number.What will you do if it says:
"15 ways to find topics 42 new" -
Split a string using Match Pattern function
I am trying to split a response string from a climate chamber into different parts. The string goes something like this: 0030.0\s0034.6\s0080.0\s0083.4. I am using the match pattern function to split the string using \s as the search string. But it is not splitting the string as required. If I use only \ , its working fine. Can anyone please suggest why \s is not being recognised as a part of the input string?
Subhro.
Solved!
Go to Solution.Is the string you show in normal display mode or in \ codes display mode?
Anyway, if you need to match a '\' character you'll have to mask it using \, so the match string would be '\\s' to match '\s'.
Alternatively you could use spreadsheet string to array with the correct delimiter. For the data you show this would work perfectly. -
Extracting OBJECTGUID using DBMS_LDAP package
Hi,
My final goal of this exercise is to search a LDAP for an objectGUID and get the sAMAccountName of the user.
But to get the things started I'm trying the easier way and doing the reverse..
But when I extract objectGUID by searching for sAMAccountName in LDAP - I get the objectguid in the following two formats.
1. utl.cast_to_raw(substr(temp_vals(i),1,200)): 7E0C3F3F3F3F3F31333F783F
2. substr(temp_vals(i),1,200) : ~ ?????13?x?
But I would like to extract the GUID in the escaped format \7e\0c\3f\3f.................... format and which is 48 characters long. Can someone point me in the right direction as to how I can achieve my result both ways.??
Thanks in Advance
Any Pointers will be appreciated!!Thanks Justin and Billy for your replies..
Here is the code I'm using. As mentioned earlier I would like to obtain my results in escaped format e.g. (\a6\53\6d\40\03\e6\83\45\ae\9a\32\a5\95\6b\e8\f1)
This is because a third party application stores user id's in the above format and I would like to join my retrieved results from LDAP with it. Once I achieve this I would also like to do the reverse i.e. pass the escaped values and retrieve the user information from LDAP.
Currently when I pass sAMAccountName, I do get the following formats based on what function I use.
1. (SUBSTR(temp_vals(i), 1, 200) -> Results in ~ ?????13?x?
2. utl_raw.cast_to_raw(SUBSTR(temp_vals(i), 1, 200)) -> Results in 7E0C3F3F3F3F3F31333F78EF
I simply cannot escape the values given in step two because I believe both are in different format as binary, raw string etc..
Please let me know if this is achievable ??
CREATE OR REPLACE PROCEDURE "Schema"."LDAP_PROC" IS
ldap_host VARCHAR2(512); -- The LDAP Directory Host
ldap_port VARCHAR2(512); -- The LDAP Directory Port
ldap_user VARCHAR2(512); -- The LDAP Directory User
ldap_guid VARCHAR2(512); -- To store the GUID
ldap_passwd VARCHAR2(512); -- The LDAP Directory Password
ldap_baseDN VARCHAR2(512); -- The starting (base) DN
retval PLS_INTEGER; -- Used for all API return values.
my_session DBMS_LDAP.SESSION; -- Used to store our LDAP Session
res_attrs DBMS_LDAP.STRING_COLLECTION; -- A String Collection used
-- to specify which
-- attributes to return
-- from the search.
-- attribute.
search_filter VARCHAR2(512); -- A simple character string used to
-- store the filter (criteria) for
-- the search.
res_message DBMS_LDAP.MESSAGE; -- Used to store the message
-- (results) of the search.
temp_entry DBMS_LDAP.MESSAGE; -- Used to store entries retrieved
-- from the LDAP search to print
-- out at a later time.
entry_index PLS_INTEGER; -- Used as a counter while looping
-- through each entry. As we
-- retrieve an entry from the LDAP
-- directory, we increase the
-- counter by one.
temp_dn VARCHAR2(512); -- After each entry is retrieved
-- from the LDAP directory (from
-- the search), we want to use
-- this variable to extract, store
-- and print out the DN for each
-- entry.
temp_attr_name VARCHAR2(512); -- After retrieving an entry from
-- LDAP directory, we will want to
-- walk through all of the
-- returned attributes. This
-- variable will be used to store
-- each attribute name as we loop
-- through them.
temp_ber_elmt DBMS_LDAP.BER_ELEMENT;
attr_index PLS_INTEGER; -- Used as a counter variable for
-- each entry returned for each
-- entry.
temp_vals DBMS_LDAP.STRING_COLLECTION; -- Used to extract, store,
-- temp_vals DBMS_LDAP.BINVAL_COLLECTION; -- and print each of the
-- values from each
-- attribute.
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
retval := -1;
ldap_host := 'LDAP_Server_name';
ldap_port := '389';
ldap_user := 'Username';
ldap_passwd := 'Password';
ldap_baseDN := 'DC=XXX,DC=XX,DC=XX';
-- Print out variables.
DBMS_OUTPUT.PUT_LINE('DBMS_LDAP Search Example');
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Host ', 25, ' ') || ': ' || ldap_host);
DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Port ', 25, ' ') || ': ' || ldap_port);
DBMS_OUTPUT.PUT_LINE(RPAD('LDAP User ', 25, ' ') || ': ' || ldap_user);
DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Base ', 25, ' ') || ': ' || ldap_baseDN);
DBMS_LDAP.USE_EXCEPTION := TRUE;
-- Obtain an LDAP session. The init() function initializes a session with an
-- LDAP server. This actually establishes a connection with the LDAP server
-- and returns a handle to the session which can be used for further
-- calls into the API.
my_session := DBMS_LDAP.INIT(ldap_host, ldap_port);
DBMS_OUTPUT.PUT_LINE (
RPAD('LDAP Session ', 25, ' ') || ': ' ||
RAWTOHEX(SUBSTR(my_session, 1, 16)) ||
' - (returned from init)'
-- Bind to the directory. The function simple_bind_s can be used to perform
-- simple username/password based authentication to the directory server.
-- The username is a directory distinguished name. This function can be
-- called only after a valid LDAP session handle is obtained from a call to
-- DBMS_LDAP.init(). If the connection was successful, it will return:
-- DBMS_LDAP.SUCCESS. This function can raise the following exceptions:
-- invalid_session : Raised if the session handle ld is invalid.
-- general_error : For all other errors. The error string associated
-- with this exception will explain the error in
-- detail.
retval := DBMS_LDAP.SIMPLE_BIND_S(my_session, ldap_user, ldap_passwd);
DBMS_OUTPUT.PUT_LINE(
RPAD('simple_bind_s Returned ', 25, ' ') || ': '|| TO_CHAR(retval)
-- Before actually performing the sort, I want to setup the attributes I
-- would like returned. To do this, I declared a "String Collection" that
-- will be used to store all of the attributes I would like returned.
-- If I wanted to return all attributes, I would specify:
-- res_attrs(1) := '*';
-- If I wanted multiple (specified) attributes, I would specify:
-- res_attrs(1) := 'cn';
-- res_attrs(2) := 'loginShell';
--res_attrs(1) := 'uid';
-- res_attrs(2) := 'cn';
res_attrs(1) := 'objectGUID';
-- res_attrs(2) := 'sAMAccountName';
-- Finally, before performing the actual search, I want to specify the
-- criteria I want to search on. This will be passed as the "filter"
-- parameter to the actual search.
-- If you wanted all of the entries in the directory to be returned,
-- you could simply specify:
-- search_filter := 'objectclass=*';
-- You could also refine your search my specify a criteria like the
-- following:
-- search_filter := 'cn=*Hunter*';
search_filter := 'sAMAccountName=*282618726*';
-- Finally, let's issue the search. The function search_s performs a
-- synchronous search in the LDAP server. It returns control to the PL/SQL
-- environment only after all of the search results have been sent by the
-- server or if the search request is 'timed-out' by the server.
-- Let's first explain some of the incoming parameters:
-- ld : A valid LDAP session handle.
-- base : The dn of the entry at which to start the search.
-- scope : One of SCOPE_BASE (0x00)
-- SCOPE_ONELEVEL (0x01)
-- SCOPE_SUBTREE (0x02)
-- indicating the scope of the search.
-- filter : A character string representing the search filter. The
-- value NULL can be passed to indicate that the filter
-- "(objectclass=*)" which matches all entries is to be
-- used.
-- attrs : A collection of strings indicating which attributes to
-- return for each matching entry. Passing NULL for this
-- parameter causes all available user attributes to be
-- retrieved. The special constant string NO_ATTRS ("1.1")
-- MAY be used as the only string in the array to indicate
-- that no attribute types are to be returned by the server.
-- The special constant string ALL_USER_ATTRS ("*") can be
-- used in the attrs array along with the names of some
-- operational attributes to indicate that all user
-- attributes plus the listed operational attributes are to
-- be returned.
-- attronly : A boolean value that MUST be zero if both attribute types
-- and values are to be returned, and non-zero if only types
-- are wanted.
-- res : This is a result parameter which will contain the results
-- of the search upon completion of the call. If no results
-- are returned, res is set to NULL.
-- Now let's look at the two output parameters:
-- PLS_INTEGER
-- (function return) : DBMS_LDAP.SUCCESS if the search operation
-- succeeded. An exception is raised in all other
-- cases.
-- res (OUT parameter) : If the search succeeded and there are entries,
-- this parameter is set to a NON-NULL value
-- which can be used to iterate through the
-- result set.
retval := DBMS_LDAP.SEARCH_S(
ld => my_session
, base => ldap_baseDN
, scope => DBMS_LDAP.SCOPE_SUBTREE
, filter => search_filter
, attrs => res_attrs
, attronly => 0
, res => res_message
DBMS_OUTPUT.PUT_LINE(
RPAD('search_s Returned ', 25, ' ') || ': ' || TO_CHAR(retval)
DBMS_OUTPUT.PUT_LINE (
RPAD('LDAP Message ', 25, ' ') || ': ' ||
RAWTOHEX(SUBSTR(res_message, 1, 16)) ||
' - (returned from search_s)'
-- After the search is performed, the API stores the count of the number of
-- entries returned.
retval := DBMS_LDAP.COUNT_ENTRIES(my_session, res_message);
DBMS_OUTPUT.PUT_LINE(
RPAD('Number of Entries ', 25, ' ') || ': ' || TO_CHAR(retval)
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
-- Retrieve the first entry.
temp_entry := DBMS_LDAP.FIRST_ENTRY(my_session, res_message);
entry_index := 1;
-- Loop through each of the entries one by one.
WHILE temp_entry IS NOT NULL LOOP
-- Print out the current entry.
temp_dn := DBMS_LDAP.GET_DN(my_session, temp_entry);
DBMS_OUTPUT.PUT_LINE (' dn: ' || temp_dn);
temp_attr_name := DBMS_LDAP.FIRST_ATTRIBUTE(
my_session
, temp_entry
, temp_ber_elmt
attr_index := 1;
WHILE temp_attr_name IS NOT NULL LOOP
temp_vals := DBMS_LDAP.GET_VALUES(my_session, temp_entry, temp_attr_name);
IF temp_vals.COUNT > 0 THEN
FOR i IN temp_vals.FIRST..temp_vals.LAST LOOP
DBMS_OUTPUT.PUT_LINE(
RPAD(' ' || temp_attr_name, 25, ' ') ||
': ' ||(SUBSTR(temp_vals(i), 1, 200)
-- (SUBSTR(temp_vals(i), 1, 200) -> Results in ~ ?????13?x?
--utl_raw.cast_to_raw(SUBSTR(temp_vals(i), 1, 200)) -> Results in 7E0C3F3F3F3F3F31333F78EF
--BUT i WOULD LIKE TO GET MY RESULTS BACK IN THE FOLLOWING FORMAT
--\a6\53\6d\40\03\e6\83\45\ae\9a\32\a5\95\6b\e8\f1
--The format given above is an example only...
END LOOP;
END IF;
temp_attr_name := DBMS_LDAP.NEXT_ATTRIBUTE( my_session
, temp_entry
, temp_ber_elmt);
attr_index := attr_index + 1;
END LOOP;
temp_entry := DBMS_LDAP.NEXT_ENTRY(my_session, temp_entry);
DBMS_OUTPUT.PUT_LINE('=======================================================================');
entry_index := entry_index + 1;
END LOOP;
-- Unbind from the directory
retval := DBMS_LDAP.UNBIND_S(my_session);
DBMS_OUTPUT.PUT_LINE(RPAD(
'unbind_res Returned ', 25, ' ') || ': ' ||
TO_CHAR(retval)
-- Handle Exceptions
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('Exception Encountered');
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE(' Exiting.');
END;
END LOOP;
END IF;
temp_attr_name := DBMS_LDAP.NEXT_ATTRIBUTE( my_session
, temp_entry
, temp_ber_elmt);
attr_index := attr_index + 1;
END LOOP;
temp_entry := DBMS_LDAP.NEXT_ENTRY(my_session, temp_entry);
DBMS_OUTPUT.PUT_LINE('=======================================================================');
entry_index := entry_index + 1;
END LOOP;
-- Unbind from the directory
retval := DBMS_LDAP.UNBIND_S(my_session);
DBMS_OUTPUT.PUT_LINE(RPAD(
'unbind_res Returned ', 25, ' ') || ': ' ||
TO_CHAR(retval)
-- Handle Exceptions
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('Exception Encountered');
DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE(' Exiting.');
END; -
Xslt copy-of creates a xml which returns empty while trying to access elements using XPATH
Hi
I am trying to do a copy-of function using the XSLT in jdev. This is what I do
<xsl:param name="appdataDO"/>
<xsl:template match="/">
<ns1:applicationData>
<ns1:applicationId>
<xsl:value-of select="$appdataDO/ns1:applicationData/ns1:applicationId"/>
</ns1:applicationId>
<xsl:copy-of select="/fslo:ExternalapplicationData/fslo:ApplicationsHDRAddInfo">
</xsl:copy-of>
</ns1:applicationData>
</xsl:template>
</xsl:stylesheet>
After this I can see the document created in the process flow as this :
<ns1:applicationData>
<ns1:applicationId>MMMM</ns1:applicationId>
<ns2:ApplicationsHDRAddInfo>
<ns3:genericFromBasePrimitive>iuoui</ns3:genericFromBasePrimitive>
<ns4:EstimatedMarketValue>77</ns4:EstimatedMarketValue>
<ns4:PropertyInsuranceFee>jih</ns4:PropertyInsuranceFee>
<ns4:LoanOriginationFee>hjh</ns4:LoanOriginationFee>
<ns4:RegistrarFee>kkkkk</ns4:RegistrarFee>
<ns4:LoanCashInFee>hjh</ns4:LoanCashInFee>
<ns4:LoanPaidInCashFlag>cddffgd</ns4:LoanPaidInCashFlag>
</ns2:ApplicationsHDRAddInfo>
</ns1:applicationData>
But whenever I am trying to extract any of the output nodes I am getting an empty result. I can copy the whole dataset into similar kind of variable.
But I am unable to get individual elements using XPATH.
I tried using exslt function for node set and xslt 2.0 without avail.
The namespaces might be the culprit here . The test method in the jdev is able to output a result but at runtime the xpath returns empty .
I have created another transform where I try to copy data from the precious dataobject to a simple string in another data object .
This is the test sample source xml for the transform created by jdev while testing with all namespaces, where I try to copy the data in a simple string in another data object.
<applicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/bpmpa/fs/ulo/types file:/C:/JDeveloper/NewAPP/Xfrm/xsd/ApplicationData.xsd" xmlns="http://xmlns.oracle.com/bpmpa/fs/ulo/types">
<applicationId>applicationId289</applicationId>
<ApplicationsHDRAddInfo>
<genericFromBasePrimitive xmlns="http://xmlns.oracle.com/bpm/pa/extn/types/BasePrimitive">genericFromBasePrimitive290</genericFromBasePrimitive>
<EstimatedMarketValue xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">291</EstimatedMarketValue>
<PropertyInsuranceFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">PropertyInsuranceFee292</PropertyInsuranceFee>
<LoanOriginationFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanOriginationFee293</LoanOriginationFee>
<RegistrarFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">RegistrarFee294</RegistrarFee>
<LoanCashInFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanCashInFee295</LoanCashInFee>
<LoanPaidInCashFlag xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanPaidInCashFlag296</LoanPaidInCashFlag>
</ApplicationsHDRAddInfo>
</applicationData>
And the xslt
<xsl:template match="/">
<ns1:DefaultOutput>
<ns1:attribute1>
<xsl:value-of select="/fslo:applicationData/fslo:ApplicationsHDRAddInfo/custom:LoanOriginationFee"/>
</ns1:attribute1>
</ns1:DefaultOutput>
</xsl:template>
This results in a empty attribute1. Any help will be appreciated .Please delete attributeFormDefault="qualified" elementFormDefault="qualified" from your XSD
Please check the next link:
http://www.oraclefromguatemala.com.gt/?p=34 -
Translate string using hex(0020) in Unicode system.
Hello all,
We are facing a problem of the "translate" statement in the Unicode system.
The original statement goes as follows:
TRANSLATE BULOG USING WS_STRING1.
Here BULOG is a structure and ws_string1 is declared as follows:
DATA : ws_string1(2) type x value '0020'.
On compilation in the new system which is Unicode enabled, the above mentioned statement removes all the '#' placed in the structure.
We tried the following statement instead of the original TRANSLATE statement.
TRANSLATE BULOG USING SPACE.
But this statement leaves the '#' unchanged.
We have already REPLACE statement after converting the structure contents into a string.
We have also tried the convert methods of the classes CL_ABAP_CONV_IN_CE and CL_ABAP_CONV_OUT_CE.
Hoping to receive a fast response.
Thanks in advance.
Zankruti.You might want to read ABAP Help on TRANSLATE:
Addition 2
... USING pattern
Effect
If you specify USING, the characters in text are converted according to the rule specified in pattern.
pattern must be a character-type data object whose contents are interpreted as a sequence of
character pairs.
Your option 1 is not working because type X is "Byte field", technically it's not a character-type. Your option 2 is not working because <pattern> must be a sequence of character pairs (you had just SPACE).
In Option 1 just change the definition from X to C or STRING. -
Problem: Problem
is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
Environment: -
Operating
System:
Windows XP SP2/7
Language:
C#
MS
Office Version: - MS Office 2007/2010/2013
Problem
Description: -
We
havedocx
file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
Docx
file format (Sample.docx)
Test this music
Word processing
Testing docx file
Output:
- Test this music Word processing Testing docx file
Requirement:
- We
have requirement to get following text in particular format with New Line from docx because client is using docx format only.
Test this music
Word processing
Testing docx file
Attempt:
We have tried a lot after changing IFilter configuration,
but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
Because it is application specific problem, kindly
assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
Doc Filter Location: - %systemroot%\system32\OffFilt.dll
Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
Code Snippet for setting property of filter
internal static IFilter LoadAndInitIFilter(string fileName, string extension)
IFilter filter
= LoadIFilter(extension);
if (filter
== null)
return null;
IPersistFile persistFile
= (filter as IPersistFile);
if (persistFile
!= null)
persistFile.Load(fileName, 0);
IFILTER_FLAGS flags;
IFILTER_INIT iflags
=
IFILTER_INIT.CANON_HYPHENS
|
IFILTER_INIT.CANON_PARAGRAPHS
|
IFILTER_INIT.CANON_SPACES
|
IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
|
IFILTER_INIT.HARD_LINE_BREAKS
|
IFILTER_INIT.FILTER_OWNED_VALUE_OK;
if (filter.Init(iflags,
0, IntPtr.Zero, out flags)
==IFilterReturnCode.S_OK)
return filter;
Marshal.ReleaseComObject(filter);
return null;
Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we would be really
thankful.Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we
would be really thankful. -
When i am trying to extract Dimension into .txt file. I am getting error.
Hi All,
When i am trying to extract the Essbase Dim into .txt file, i am getting below error.
Please find the details.
V10.1.3.5.0 and MySql server as database.
com.sunopsis.sql.c: com.sunopsis.jdbc.file.FileDriver
at com.sunopsis.sql.SnpsConnection.a(SnpsConnection.java)
at com.sunopsis.sql.SnpsConnection.t(SnpsConnection.java)
at com.sunopsis.sql.SnpsConnection.connect(SnpsConnection.java)
at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.h.y(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:662)
Please help me in this issue.
Regards,
Krish
Edited by: 897734 on Dec 20, 2011 2:40 AMIf you think a file doesn't exists when you think it should, you can use code like this to print out what files are there:
import java.io.*;
public class Periscope {
public static void check(File file) {
if (file.exists()) {
System.out.println("file exists: " + getPath(file));
System.out.println();
System.out.println("DUMP:");
System.out.println();
dump(file, "");
} else {
System.out.println("file does not exist: " + getPath(file));
goUp(file);
static void goUp(File file) {
File parent = file.getAbsoluteFile().getParentFile();
if (parent == null) {
System.out.println("file does not have a parent: " + getPath(file));
} else {
check(parent);
static void dump(File file, String indent) {
System.out.println(indent + getPath(file));
File[] children = file.listFiles();
if (children != null) {
indent += " ";
for(File child : children) {
dump(child, indent);
static String getPath(File file) {
try {
return file.getCanonicalPath();
} catch (IOException e) {
e.printStackTrace();
return file.getName();
public static void main(String[] args) {
check(new File("foo.bar"));
} -
How to Use Pattern and Matcher class.
HI Guys,
I am just trying to use Pattern and Matcher classes for my requirement.
My requirement is :- It should allow the numbers from 1-7 followed by a comma(,) again followed by the numbers from
1-7. For example:- 1,2,3,4,5 or 3,6,1 or 7,1,3 something like that.
But it should not allow 0,8 and 9. And also it should not allow any Alphabets and special characters except comma(,).
I have written some thing like..
Pattern p = Pattern.compile("([1-7])+([\\,])?([1-7])?");
Is there any problem with this pattern ??
Please help out..
I am new to pattern matching concept..
Thanks and regards
Sudheerok guys, this is how my code looks like..
class PatternTest
public static void main(String[] args)
System.out.println("Hello World!");
String input = args[0];
Pattern p = Pattern.compile("([1-7]{1},?)+");
Matcher m = p.matcher(input);
if(m.find()) {
System.out.println("Pattern Found");
} else {
System.out.println("Invalid pattern");
}if I enter 8,1,3 its accepting and saying Pattern Found..
Please correct me if I am wrong.
Actually this is the test code I am presenting here.. I original requirement is..I will be uploading an excel sheets containg 10 columns and n rows.
In one of my column, I need to test whether the data in that column is between 1-7 or not..If I get a value consisting of numbers other than 1-7..Then I should
display him the msg..
Thanks and regards
Sudheer -
Extract string between two parts
Hi all,
I am trying to extract a string using the regexp substr with no luck:
string is :
ws-servername.domain name
example:
ws-db1.mydomain
desired outcome :
servername only
any ideas ?
Thanks
YoavSELECT Regexp_Substr('ws-servername.domain name',
'[^\.^\-]+',
1,
Rn + 1)
FROM (SELECT Regexp_Count('ws-servername.domain name',
'[-]+') Rn
FROM Dual)Edited by: Sen on Dec 6, 2011 5:14 AM -
Extracting string inside double quote
Hi,
In perl this is really easy, but I can't get it to work correclt in java. I'm trying to extract a string that is in double quotes following a keyword...
String: SRCH base="o=answer" filter="me" attrs=ALL
I want to extract the first quoted value after "SRCH base="
In perl I used: / SRCH base=\"(.*)\" /i
In java I'm using: " SRCH base=\"(.*)\" "
The problem is that it doesn't stop after hitting the second quote. So I get this result:
o=answer" filter="me
Notice that it stopped matching after hitting the third quote. Weird.
I know this is probably really simple, but I'm stumped.
Thanks,
MarkI guess if you wrote a regex that matches any string
that starts with ", ends with ", and has anything in
between you could use a Matcher to find each
occurrence, but I don't regex enough to write it :)[url #" style="display: block; background-image: url('http://www.shanghaiist.com/attachments/shang_neil/bat-signal-edit.jpg'); width: 325px; height: 217px] -
Need Help in Splitting a String Using SQL QUERY
Hi,
I need help in splitting a string using a SQL Query:
String IS:
AFTER PAINT.ACOUSTICAL.1..9'' MEMBRAIN'I would like to seperate this string into multiple lines using the delimeter .(dot)
Sample Output should look like:
SNO STRING
1 AFTER PAINT
2 ACOUSTICAL
3 1
4
5 9" MEMBRAIN
{code}
FYI i am using Oracle 9.2There's this as well:
with x as ( --generating sample data:
select 'AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN' str from dual union all
select 'BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN' str from dual)
select str,
row_number() over (partition by str order by rownum) s_no,
cast(dbms_xmlgen.convert(t.column_value.extract('//text()').getstringval(),1) as varchar2(100)) res
from x,
table(xmlsequence(xmltype('<x><x>' || replace(str,'.','</x><x>') || '</x></x>').extract('//x/*'))) t;
STR S_NO RES
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 1 AFTER PAINT
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 2 ACOUSTICAL
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 3 1
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 4
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 5 9" MEMBRAIN
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 1 BEFORE PAINT
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 2 ELECTRIC
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 3 2
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 4
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 5 45 caliber MEMBRAIN
{code} -
Invalid column name in query string - using Format function
In my post just before this one the problem was solved for writing a query string using a date range. The rest of the query string includes the same date field (Call_Date) but formatted as 'MMM-YY'. I get an invalid column name error when I add this field to the query string. Here is the rest of the query string:
strSql = "SELECT Format(CALL_DATE,'mmm-yy'), " _
& "HOME_REGION FROM CCC2.CASE_EPRP " _
& "WHERE (HOME_REGION = 'NCR') AND " _
"(CALL_DATE >= to_date( '1/1/2002', 'MM/DD/YYYY' )" _
& "AND CALL_DATE <= to_date( '2/28/2003', 'MM/DD/YYYY' ))"
In the Access Query tool I can include this field
Format(CALL_DATE,'mmm-yy')
and the query runs fine (I just need to make it dynamic using ADO). But in my ADO query string above, I get the invalid column name error. Is there a way I can include
Format(CALL_DATE,'mmm-yy')
in my ADO query string? I appologize for not being more familiar with Oracle Sql. Any help greatly appreciated.
Thanks again,
RichThank you very much for your reply. I think I'm getting closer to the solution. Just I got an error message
"date format not recognized"
when I add "to_char( call_date, 'mmm-yy' )" to the query string. I tried using all uppercase, but that did not make a difference. Do I need to use to_date inside the to_char maybe?
to_char(to_date(call_date, 'mmm/yy'), 'mmm-yy')
Thanks again for your help.
Rich -
How to search for upper/lower case using string using JAVA!!!?
-I am trying to write a program that will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter 'e' appears.
-I also have to use a JOptionPane.showMessageDialog() to tell the user how many upper and lower case e's were in the string.
-This will be repeated until the user types the word "Stop".
please help if you can
what i have so far:
[code]
public class Project0 {
public static void main(String[] args) {
String[] uppercase = {'E'};
String[] lowercase = {'e'};
String isOrIsNot, inputWord;
while (true) {
// This line asks the user for input by popping out a single window
// with text input
inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
if ( inputWord.equals("stop") )
System.exit(0);
// if the inputWord is contained within uppercase or
// lowercase return true
if (wordIsThere(inputWord, lowercase))
isOrIsNot = "Number of lower case e's: ";
if (wordIsThere(inputword, uppercase))
isOrIsNot = "number of upper case e's: ";
// Output to a JOptionPane window whether the word is on the list or not
JOptionPane.showMessageDialog(null, "The word " + inputWord + " " + isOrIsNot + " on the list.");
} //main
public static boolean wordIsThere(String findMe, String[] theList) {
for (int i=0; i<theList.length; ++i) {
if (findMe.equals(theList[i])) return true;
return false;
} // wordIsThere
} // class Lab4Program1
[/code]So what is your question? Do you get any errors? If so, post them. What doesn't work?
And crossposted: how to search for upper/lower case using string using JAVA!!!?
Maybe you are looking for
-
Weblogic 10.3.2: Under load, system gives 404 error when accessing page
Hi all, I am running Weblogic 10.3.2 with a J2EE EAR deployed against it. I am using JDBC data sources to connect to an Oracle 11g database. I am running on Linux Red Hat 5. The machine has 16 GB RAM and 16 cores of an Intel Xeon processor. I have re
-
Hi Guys! I have a requirement: SOAP <-> PI <-> JDBC(AS/400). I work with SAP PI 7.10 We will concentrate in connection PI to AS/400 The steps already ok are: *From http://sourceforge.net/projects/jt400/ we obtain the driver jt400.jar, it is was depl
-
White lines on movie exported in DVD
ehi guys. I did just a nice movie with the suggestions of some members of this forum but at the end the quality of a 30minutes movie exported in DVD was not so much principally because of some white lines present in some pieces of the movie. These wh
-
Hello, I can't seem to get my image to show in my podcast. Everything else checks out OK. prettygoodgig uses Wordpress and feedburner. The image shows on the feedburner site. It has been about 3 weeks and still does not show in itunes. I have tried c
-
Using display/consolehelper gives "Unknown Error"
Dear Experts, I'm using Redhat 5.5 cat redhat-release Red Hat Enterprise Linux Server release 5.5 (Tikanga) uname -a Linux black.testrac.com 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux When I go to check the disp