Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Extracting specific portion of a string using REGEX

buggleboy007Apr 6 2020 — edited Apr 7 2020

I have a string(or two records) of the type:

a) C:\Users\user1\Pictures\1.JPG

b) C:\Users\user1\Pictures\file_example_TIFF_1MB.tiff

I am using the following query to extract the name of the file and I am only able to pull the 1st record out (1.JPG).

When I use this:

select dt, seq, message,REGEXP_SUBSTR(message,  '[0-9]+(.JPG|.TIFF|.tiff)+')

from log_output_table where seq in (23438852,23438853); 

Output is only : 1.JPG

When I use this:

select dt, seq, message,REGEXP_SUBSTR(message,  '[[:alnum:]]+(.JPG|.TIFF|.tiff)+')

from log_output_table where seq in (23438852,23438853); 

Output is:

1.JPG

example_TIFF

How can I pull both - first and second (1.jpg and file_example_TIFF_1MB.tiff) including any file extension (whether upper or lower case).

This post has been answered by mathguy on Apr 6 2020
Jump to Answer

Comments

David Grieve-Oracle
http://docs.oracle.com/javafx/2/api/javafx/scene/control/Labeled.html#setContentDisplay(javafx.scene.control.ContentDisplay)
edward17
Cryptic API reference not helpful.
957628
radioButton.setContentDisplay(ContentDisplay.LEFT);
jsmith
ContentDisplay seems like a good solution - it just doesn't work for RadioButtons.
Most of the radio buttons with different content display settings in the example below end up being laid out identically.
package javafxsamples;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.RadioButton;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class RadioContentDisplayFailure extends Application {
  public static void main(String[] args) { launch(args); }
  @Override public void start(Stage stage) throws Exception {
    VBox radios = new VBox(15);
    for (ContentDisplay display: ContentDisplay.values()) {
      RadioButton radio = new RadioButton("radio-text: " + display);
      radio.setStyle("-fx-background-color: coral; -fx-border-color: red;");
      radio.setContentDisplay(display);
      radios.getChildren().add(radio);
    }
    radios.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    stage.setScene(new Scene(radios));
    
    stage.show();
  }
}
edward17
The FXML version of this solution is ignored and the code version (as indicated) results in an error:

WARNING: com.sun.javafx.css.StyleHelper calculateValue caught: java.lang.IllegalArgumentException: Parsed value is not an Effect

Edited by: edward17 on Aug 23, 2012 12:51 PM
jsmith
The FXML version of this solution is ignored
Nobody provided as FXML solution for this, I guess you wrote one and it worked as my code sample did (i.e. the ContentDisplay setting for a radio button does nothing), which is what I would have expected given the code sample output.
the code version (as indicated) results in an error . . . .css.StyleHelper . . . Parsed value is not an Effect
The code sample I provided does not have any reported error (it just shows that ContentDisplay does not really affect the layout of a RadioButton).

I believe the stylehelper error you reported is related to some other css you use in your application which you have not published here and is unrelated to radio button layout.
David Grieve-Oracle
Yeah. I should know better. setContentDisplay has to do with the graphic, not the radio button itself. Here's a hack.
     @Override
    public void start(Stage primaryStage) {

        RadioButton rb = new RadioButton("RadioButton");        
        StackPane root = new StackPane();
        root.getChildren().add(rb);
        Scene scene = new Scene(root, 300, 200);
        primaryStage.setScene(scene);
        primaryStage.show();
       
        Node radio = rb.lookup(".radio");
        Node text = rb.lookup(".text");
        double rx = radio.getBoundsInParent().getMinX();
        double tx = text.getBoundsInParent().getMaxX();
        radio.setLayoutX(tx);
        text.setLayoutX(rx);
}
shakir.gusaroff
Here is another example (but not smart):
  
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class RadioBtns extends Application {

    @Override
    public void start(Stage primaryStage) {

        ToggleGroup grp = new ToggleGroup();
        VBox vb = new VBox(5);
        vb.setPrefWidth(50);
        
        RadioButton rbHome = new RadioButton();
        rbHome.setToggleGroup(grp);
        rbHome.setSelected(true);
        Label lHome = new Label("Home ");
        HBox hbHome = new HBox();
        hbHome.setAlignment(Pos.CENTER_RIGHT);
        hbHome.getChildren().addAll(lHome, rbHome);



        RadioButton rbCal = new RadioButton();
        rbCal.setToggleGroup(grp);
        Label lCal = new Label("Calendar ");
        HBox hbCal = new HBox();
        hbCal.setAlignment(Pos.CENTER_RIGHT);
        hbCal.getChildren().addAll(lCal, rbCal);


        RadioButton rbContact = new RadioButton();
        rbContact.setToggleGroup(grp);
        Label lContact = new Label("Contact ");
        HBox hbContact = new HBox();
        hbContact.setAlignment(Pos.CENTER_RIGHT);
        hbContact.getChildren().addAll(lContact, rbContact);
       
        vb.getChildren().addAll(hbHome, hbCal, hbContact);

        Scene scene = new Scene(vb, 300, 250);

        primaryStage.setTitle("Radio buttons");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
jsmith
Thanks for posting the hack David.

I created http://javafx-jira.kenai.com/browse/RT-24461 "Positioning of a radio button dot relative to it's label" to track whether a more elegant solution should be added to the core api or not.
edward17
Thanks Shakir, I agree is kludgy but I used your solution in the interim
1 - 10

Post Details

Added on Apr 6 2020
13 comments
3,380 views