How can I reference a variable in Regexp
Hello Friends,
I have this Regexp, to extract the county code: (971)
select regexp_replace (regexp_replace('000971-05 7910 - 324324','\D'),'^0*(971)?0?') from dual;It is fine and does the need..
But, thinking in the future, someone may need to eliminate the country code of (961), so it is better if I put the code in a variable, but
How can I reference the county code using a variable in Regexp:
declare
a varchar2 (15);
code number := 971;
begin
select regexp_replace(regexp_replace('000971 05 7910 - 324324','\D'),'^0*(code)?0?') into a from dual;
dbms_output.put_line ( a);
end;but, it does not work ??
Best Regards,
Fateh
venx08 wrote:
You need to bind the code variable value in the regular expression patternYes, that's the idea, but there is a caveat. You might need to escape every regexp special character that appears in code. If, for example code is 'A*B' you need to transform it into 'A\*B' unless you really want 'A*B' to be interpreted as uppercase A repeated zero or more times followed by uppercase B.
SY.
Similar Messages
-
How can I reference a winforms control using a variable in Powershell?
I have a powershell winform that has a lot of text boxes, but for the sake of this post, lets say I have 5. I want to loop through the 5 text boxes to see if their text property is empty. If the textbox contains something, I want to add the text value to
an array. Here's an example of what I'm trying to do.
textbox1.text = "Red"
textbox2.text = ""
textbox3.text = "Blue"
textbox4.text = ""
textbox5.text = ""
$MyArray = @()
for ($i = 1; $i -le 5; $i++) {
If ($textbox[$i].text -ne "") {
$MyArray += $textbox[$i].text
I realize the textbox object is not an array so this code will not work. I guess the simple question is, How can I reference a set of static controls using a variable without having to do something like this
[object[]]$textboxes = New-Object System.Windows.Forms.TextBox
For ($i = 1; $i -lt 5; $i++) {
$textboxes += New-Object windows.forms.textbox
$textboxes[$i].DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$textboxes[$i].Name = $textboxes[$i]
$BoxItems.Controls.Add($textboxes[$i])Hi D-Dub,
here are two ways to retrieve the text value of $Textbox1:
$Textbox1.Text
(Get-Variable "Textbox1").Value.Text
Now what could you do with the second way, inside a loop, I wonder ... ;)
Cheers,
Fred
There's no place like 127.0.0.1 -
How can I access global variables in a loaded Applescript?
How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
Example:
Parent script:
script AppDelegate
property myTextField : missing value
//linked to a text field object
tell myScript to myAwesomeHandler_()
end script
Loaded script:
on myAwesomeHandler_()
myTextField's setStringValue_("The new Xcode is so glitchy ugh")
//changes value of linked text field of parent script
end myAwesomeHandler_
The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
global myTextFieldGlobal
script AppDelegate
property myTextField : missing value
//linked to a text field object
tell myScript to myAwesomeHandler_()
myTextField's setStringValue_(myTextFieldGlobal)
end script
on myAwesomeHandler_()
set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
//changes value of linked text field of parent script
end myAwesomeHandler_
I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
<edit>
Another though have you tried to define the property outside the script? That is
property myTextField : missing value
script AppDelegate
Not sure if that will work.
You might also want to have a look at Scope of Properties and Variables Declared in a Script Object -
How can one reference symbols from PutBIN.pl?
I've been working on some code with a large number of static
variables, and my startup times have gotten so slow that my swf
will hit the fifteen second timeout before actually doing anything.
Confuddled by this, I examined the code being generated and
eventually realised that Alchemy allocates all static values one
byte at a time, dynamically in Actionscript, at startup. This is
less than ideal when one has large static arrays.
So, as my code is not much use timing out, I spent some time
writing a bash script to parse the $$.achacks.as sourcefile
generated by alchemy, track all the static global variables, and
write their values out into a memory file in advance. The script
then removes all non-function-pointer references to StaticInitter,
which is what processes the byte-by-byte initialisations, and
replaces them with a single ByteArray readBytes() call. After these
changes, I allow alchemy to compile my new code into the resulting
swc/exe/swf. I expect it would now start up lightning fast.
For this to work, the assumption is that I can get a
ByteArray into the code that already contains the values I need. I
tried using [Embed()] metadata, but alchemy does not seem to
support it. I suppose that is what PutBIN.pl is for -- and hence my
question.
How can one reference a symbol loaded with PutBIN.pl? What
must be passed to it and how is that related to what's in the code?
Is there an example anywhere? I can't seem to get it to work.
If others are interested in my script, I am glad to attach
it, but it is relatively long.It's supposed to be ora_dict_obj_type. This is one of many event attributes that we can interrogate in DDL triggers. You can find out more in the online docs.
Cheers, APC -
How can I reference more than one jar file
hi, In an applet, I use
Archive = "foo.jar" to reference this jar file.
But how can I reference more than one file?
Thanks.Suggestion: spend a few minutes reading the tutorials.
http://java.sun.com/docs/books/tutorial/applet/appletsonly/html.html
You can specify multiple archive files by separating them with commas:
<APPLET CODE="myapplet.class" ARCHIVE="file1, file2" WIDTH=anInt HEIGHT=anInt>
</APPLET> -
How can I use environment variables in a controller?
Hi all,
How can I use environment variables in a controller?
I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
Is there a method somewhere that would resolve this??
By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
The following is the code.
My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
Can anyone help me on this?
private String getURL()
throws IOException
File locC = null;
File remC = new File(mPath);
String lurl = null;
CpUtil lUtil = new CpUtil();
String exten;
Connection lConn = mCtx.getJDBCConnection();
ErrorStack lES = mCtx.getErrorStack();
LogFile lLF = mCtx.getLogFile();
String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
// create temp file
mLPath = lUtil.createTempFile("OF", exten, tmpDir);
lUtil.logTempFile(mLPath, mLNode, mCtx);
Thanks,
binghaoHowever within OAF on the application it doesn't.
what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
No, it is read from the adovars.env file only.Thanks
Tapash -
How can i reference a MIME object within a correspondence format through...
how can i reference a MIME object within a correspondence format through TX oofo or se71?
Hi, I need to put a MIME object within a correspondence's format that i've already done through Tx oofo. My problem is, that i don't know exactly how can i make the reference of that MIME object in the format? and What structure type do i have to use in order to make appear the MIME object in my correspondence's format? Does anybody can help me with this?
Regards HectorFrank,
I tried to find some examples/samples on how to create CollectionModel for a table component but not successful.
Can you clarify the following ?
1. "CollectionModel" is referenced only by af:table attributes "value", "selectedRowKeys" and "selectionListener".
The rest of af:table attributes such as "rows", "fetchSize" used to reference the iterator binding in the binding container via the EL expression "#{bindings.VOIteratorBinding.xxx} .
What should I replace that EL expression with?
2. I heck out the bean method to create the CollectionModel as following, is it close to what you mean?
public void initBusinessDataDashboardView() {
OperationBinding operation = BeanUtils.getOperationBinding("getPanelBusinessData");
Map params = operation.getParamsMap();
Key panelKey = getPanelInfoView().getKey();
params.put("panelKey", panelKey);
params.put("maximizedView", false);
panelView = (ViewObject)operation.execute();
// Heck code to create CollectionModel
RowSet rowSet = panelView.getRowSet();
ArrayList rowList = new ArrayList();
while (rowSet.hasNext()) {
rowList.add(rowSet.next());
model = new ChildPropertyTreeModel(rowList, null);
// To be used to set up af:table value, selectRowKeys, selectionListener via EL expr #{backingBeanScope.MyBean.model.xxx}
public CollectionModel getModel() {
return model;
Am I on the right track?
Edited by: Pricilla on May 4, 2010 2:20 PM -
How can I set a variable number of values in a SQL IN clause?
Hi,
How can I set a variable number of values in a SQL IN clause without having to change the text of the SQL statement each time?
I read the link http://radio.weblogs.com/0118231/2003/06/18.html. as steve wrote.
SELECT *
FROM EMP
WHERE ENAME IN (?)
But we need the steps not to create type in the system and would there be any other solution if we would like to use variable number of values in a SQL IN clause ?
We are using JDeveloper 10.1.3.2 with Oracle Database 10.1.3.2
Thanks
RajHi,
can you please explain why the solution from steve is not the right solution for you.
regards
Peter -
How can I reference the last value in a column?
How can I reference the last value in a column? For example, today I want the value of A1 to appear in another cell. Tomorrow, I will add a row and want to reference A2, next day A3, and so forth.
Now I got it:
=OFFSET(A1,COUNT(A)-1,0) -
using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?
Thanks for your swift response.
That sounds like a good solution, but the code I have on frame 2 is this
timer = 0;
countup = function(){
timer++;
countupInterval = setInterval(countup,100);
If I added the same actionscript to frame 3 which has a dynamic textbox with a variable timer attached wouldn't it just put the timer back to 0? What I want is the last known value that was given when it was in frame 2.
I am thinking of temple run here, I am trying to caculate the total distance(set in the timer variable) from the previous try.
Hope this makes sense.
Chazwick -
How can I transfer a variable to regexp_replace function
Hi,
In addition to my question from yesterday, I went up one (little) level for the next question.
How can I transfer a variable to regexp_replace function?
I am getting the value of the variables from from APEX Items.
The value of item :P105_OLD_NAME should be replaced with the value from :P105_NAME APEX item.
The projects in PROJECT_NAME field are separated by “:”
select * from infoux_proj;
HOSTNAME PROJECT_NAME
host1 proj2:proj1
host3 proj1
host4 proj12:proj1
host5 proj3
host2 proj1:proj3:sunproj1
this is my code:
declare
v_old_proj_list varchar(100);
v_new_proj_list varchar(100);
begin
for host in (select a.hostname, project_name
from infoux_proj a,
(select hostname
from PROJECT_NAMES_WITH_HOSTNAMES
where name = :P105_OLD_NAME ) b
where a.HOSTNAME=b.hostname)
loop
select project_name ,
regexp_replace(project_name,'(^|:)(:P105_OLD_NAME)(:|$)','\1:P105_NAME \3') new_project
into v_old_proj_list, v_new_proj_list
from infoux_proj
where hostname=host.hostname;
update infoux_proj
set project_name=v_new_proj_list
where hostname=host.hostname;
end loop;
end;
Thanks,
SheliHi, Sheli
Inside quotes, :p105_old_name will not be taken as a variable name. If you want to use the value of :p105_old_name in a string which its otherwise a literal, then you can concatenate the variable to the literal parts, using the || operator.
You can do soemthing like this:
REGEXP_REPLACE ( project_name
, '(^|:)(' || :P105_OLD_NAME
|| ')(:|$)'
, '\1' || :P105_NAME
|| ' \3'
) AS new_projectI'll bet there's a much simpler way to do what you want. Instead of having two SELECTs, a cursor FOR loop and an UPDATE, you can probably do what you need to with just a single UPDATE or MERGE. It would be more efficient, too. If you'd like help, post CREATE TABLE and INSERT statements for all relevant tables and columns azs the exist before this code is run, a couple of sets of values for the bind variables, and the results you'd like to see (that is, the contents of the changed table) for each set, given the same sample data.
Always say which version of Oracle you're using. -
How can I get the variable with the value from Thread Run method?
We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
How can I get the variable with the value?
This is sample code:
public class SampleSynchronisation
public static void main(String df[])
sampleThread sathr= new sampleThread();
sathr.start();
System.out.println("This is the value from the run method "+sathr.x);
// I should get Inside the run method::: But I get only Inside
class sampleThread extends Thread
public String x="Inside";
public void run()
x+="the run method";
NB: if i write the variable in to a file I am able to read it from external method. This I dont want to doWe want to access a variable from the run method of a
Thread externally in a class or in a method. I presume you mean a member variable of the thread class and not a local variable inside the run() method.
Even
though I make the variable as public /public static, I
could get the value till the end of the run method
only. After that scope of the variable gets lost
resulting to null value in the called method/class..
I find it easier to implement the Runnable interface rather than extending a thread. This allows your class to extend another class (ie if you extend thread you can't extend something else, but if you implement Runnable you have the ability to inherit from something). Here's how I would write it:
public class SampleSynchronisation
public static void main(String[] args)
SampleSynchronisation app = new SampleSynchronisation();
public SampleSynchronisation()
MyRunnable runner = new MyRunnable();
new Thread(runner).start();
// yield this thread so other thread gets a chance to start
Thread.yield();
System.out.println("runner's X = " + runner.getX());
class MyRunnable implements Runnable
String X = null;
// this method called from the controlling thread
public synchronized String getX()
return X;
public void run()
System.out.println("Inside MyRunnable");
X = "MyRunnable's data";
} // end class MyRunnable
} // end class SampleSynchronisation>
public class SampleSynchronisation
public static void main(String df[])
sampleThread sathr= new sampleThread();
sathr.start();
System.out.println("This is the value from the run
method "+sathr.x);
// I should get Inside the run method::: But I get
only Inside
class sampleThread extends Thread
public String x="Inside";
public void run()
x+="the run method";
NB: if i write the variable in to a file I am able to
read it from external method. This I dont want to do -
How can I get the variable with the value from Thread's run method
We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
How can I get the variable with the value?
This is sample code:
public class SampleSynchronisation
public static void main(String df[])
sampleThread sathr= new sampleThread();
sathr.start();
System.out.println("This is the value from the run method "+sathr.x);
/* I should get:
Inside the run method
But I get only:
Inside*/
class sampleThread extends Thread
public String x="Inside";
public void run()
x+="the run method";
NB: if i write the variable in to a file I am able to read it from external method. This I dont want to doYour main thread continues to run after the sathr thread is completed, consequently the output is done before the sathr thread has modified the string. You need to make the main thread pause, this will allow sathr time to run to the point where it will modify the string and then you can print it out. Another way would be to lock the object using a synchronized block to stop the main thread accessing the string until the sathr has finished with it.
-
How can I convert the variable expression stored as string back to variable expression
How can I convert the variable expression stored as string back to variable expression?
I am storing the expression enterd in the TSExpresssionEditControl as simple string and want to convert back to expression since I want to get the data type of that expression.pritam,
I'm not sure what you're trying to do exactly. If you are trying to get the value of a variable and you only have the name of value in a string, then you can use Evaluate() to get its value. If you want the data type, my advise is to use the GetPropertyObject() API method and just pass in the loop up string. Then you'll have a handle to the data object and then proceed from there.
Regards,
Song D
Application Engineer
National Instrument
Regards,
Song Du
Systems Software
National Instruments R&D -
How can I create a variable size array?
How can I create a variable size array?
ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
Anyway, the answer to your question is, of course:
Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)
Maybe you are looking for
-
Help with submit button on PDF form
I created a form via the Forms Central desktop app then saved it as a PDF to my desktop. When opening in Adobe Acrobat XI Pro, I noticed that I am unable to include a submit button - it does not let me edit the PDF. I've tried going back into Forms
-
I uninstalled Acrobat XI Pro because it wasn't opening, now I can't reinstall.
Adobe Acrobat XI Pro stopped working on my Mac a few days ago. I updated the program, but it still wouldn't open. In searching for help, I tried a few solutions to no avail. I decided to uninstall and hoped to reinstall to resolve the issue. However,
-
Do you have to implement SRM to use the self service procurement?
I was interested in possibly using the self service procurement functionality. Do you have to implement SRM for this to be available? Thanks! Chris Lintner Aflac
-
Netflix plug in error after lion install
What is the fix for Netflix plug in error after lion install?
-
Many Ship to party assigned to 1 sold to party
Hi guru's Can any 1 tell me what is the maximum number of ship to parties assigned to 1 sold to party. Also let us know if there is limitation then what is the solution to extened the same.