GREP character to nth position

Hi Everyone,
Apologies in advance if this has been asked a zillion times before, but does anyone know how to locate a character to nth position in a certain location, e.g.
HarryPotter
I want to select the 6th character from the left, the 'P'
Also, does anyone know the GREP code for this for BBEdit?
Many thanks
gr

Hi,
use
.(?<=.{6})
to match 6th element
Jarek

Similar Messages

  • Ranking Top N but excluding ties at Nth position

    Hi,
    I have a requirement where I need to do top N analysis report. I came across problem where we have ties at Nth position, my client want not to show any Nth value because that will be misleading and if there are 3 value at Nth place then what to remove. what he want is to exclude Nth values and show only until N -1th place.
    Show top 5 from following list:
    A 100
    B  75
    C 50
    D 25
    E 5
    F 5
    G 5
    H 4
    I 3
    Webi Rank function will give following:
    A 100
    B  75
    C 50
    D 25
    E 5
    F 5
    G 5
    What I want is way to get following:
    A 100
    B  75
    C 50
    D 25
    Any thought ?
    Thanks in Advance
    Kumar

    Let's say we have the grid like:
    Dimension 
    Measure 

    10 
















    Now, sort the measure column in descending order. we get:
    Dimension 
    Measure 

    10 
















    Now, create a variable:
    v_Filter =If(RunningCount([Dimension])<=5;1;0)
    Apply a block level filter as : v_Filter Equal To 1
    You always get top 5 rows, no matter tie occurs or not.
    Dimension 
    Measure 

    10 







  • Registered schema lost one byte of Chinese character at certain position

    Hello all,
    I registered a schema as below. When viewing the registered schema in the Enterprise Manager, I found a byte was lost for the Chinese character at the position of byte 4200 ( or 0x1068 ).
    before registration:
    22 B2 FA C6 B7 CA FD C1 BF B5 A5 CE BB 22 20 ; "产品数量单位"
    after registration:
    22 B2 FA C6 B7 FD C1 BF B5 A5 CE 3F 20 ; "产品康ノ?
    My database (9.2.0.1 & 9.2.0.3) has the character set of SIMPLIFIED CHINESE_CHINA.ZHS16GBK.
    Connect test/test;
    DECLARE
    samplexmldoc clob := '<?xml version="1.0" encoding="GB2312"?>
    <xs:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <!--This is a test This is a test This is a test -->
         <xs:element name="产品目录">
              <xs:complexType xdb:SQLType="ST产品目录">
                   <xs:sequence>
                        <xs:element ref="第一种产品目录"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="第一种产品目录">
              <xs:complexType xdb:SQLType="ST第一种产品目录">
                   <xs:sequence>
                        <xs:element name="产品分类名称" type="xs:string"/>
                        <xs:element name="产品分类概况" type="xs:string"/>
                        <xs:element name="产品数量单位" type="xs:string"/>
                        <xs:element name="产品存放总分布图" type="xs:anyURI"/>
                        <xs:element name="产品样本" type="xs:anyURI"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    BEGIN
    dbms_xmlschema.registerSchema('http://www.antu.com.cn/metaxml.xsd',samplexmldoc,True,True,False,FALSE);
    End;
    Because we have to generate schemas by program, it's not acceptable to adjust the schema text manually.
    What shall I do? Thanks for any help.
    Chen Hui

    Please open a tar with your local support organization...
    Chen
    Please excuse me if I ask some basic questions here, I've no previous experience working with documents containing Chinese Character sets.
    I assume that if I look at your post with my Brower character set to simplifiedChinese.GB2312 I will see the schema document posted correctly..
    Can you test wether or not this problem occurs if the document is encoded in UTF8 and loaded into an AL32UTf8 database. Also, do you see , rather than GB2312. Also are the characters still missing if you view it from SQL*PLUS...

  • Invalid control character 0 at position 7, Error Code : UFGUIEZK

    When I first login obiee dashboard, it would error about "invalid control character 0 at position 7".
    But if I click a select button, it would show the result what I want it.
    help me please.

    Hi Joe,
    (Especially using the IE8 brower)
    When I enter any dashboard pages, (not the login page...) it would error about "invalid control character 0 at position 7".
    I press the "Backspace" button. (I keep a same brower and same session.)
    Then I enter same dashboard. It doesn't mention about the error message. -_-; It works....
    What's the points is...
    OBIEE is working~
    I can use any answers... can make any dashboards.
    Everything is gonna all right...
    Except... If I wanna the any dashboard, I would enter the page twice.
    Thanks for your concern~!
    Edited by: user1121165 on 2009. 12. 15 오후 4:29
    Edited by: user1121165 on 2009. 12. 15 오후 4:33

  • How to replace a specific character acording to position

    hi,
    tablename
    column name
    00000111111
    so,
    i need to update 6 th position only.

    I am not sure whether there is a direct inbuilt SQL function for this facility. I am giving a method to get this as below:
    Logic:
    1. Get the substring from first position to the required position minus 1 into the result string
    2. Concat the required character to the substring in the above step (result string).
    3. Concat the substring from required position plus 1 to the result string
    SQL below:
    select substr('00000111111',1,6-1) || '1' || substr('00000111111',6+1) from dual

  • Replace a character from a string

    Hi,
    how can I replace a particular character from a string on a particular occurrence? Say for eg, if i wan to replace 'a' of second occurrence from 'abcabcabc', then what should i do? I guess the normal REPLACE function replaces every occurrence in a given string. So is there any other way to solve this?
    Thanks!

    If you are in 9i:
    Then you got to split the string into based on the nth position.
    SQL> select replace('abddefabc','a','x') from dual;
    REPLACE('
    xbddefxbc
    SQL> select instr('abddefabc','a',2) from dual;
    INSTR('ABDDEFABC','A',2)
                           7
    SQL> select substr('abddefabc',1,instr('abddefabc','a',2)-1),substr('abddefabc',instr('abddefabc','a',2)) from dual;
    SUBSTR SUB
    abddef abc
    SQL> select substr('abddefabc',1,instr('abddefabc','a',2)-1),replace(substr('abddefabc',instr('abddefabc','a',2)),'a','X') as replaced from dual;
    SUBSTR REP
    abddef XbcOfcourse, later on you can join the string..
    Jithendra

  • How to search a special string in txt file and return it's position in txt file?

    How to search a special string in txt file and return it's position in txt file?

    I just posted a solution for a similar question here:  http://forums.ni.com/ni/board/message?board.id=170​&view=by_date_ascending&message.id=362699#M362699
    The top portion can search for the location of a string, while the bottom portion is to locate the position of a character.  Both can search for a character.
    The position of the character within the file is displayed in the indicator(s).
    R

  • Unprintable special character in RDP file

    We're having strange issue. We use RDP files generated in RDP client, we then sign those using rdpsign.exe.
    Recently after upgrading our infrastructure from W8/2012 to W8.1/2012R2 we noticed that every RDP file generated in RDC 8.1 client contains a special character on first position that is not visible in normal text editor and is only visible in hex editor.
    This character wasn't there in W8/2012. When I create the RDP file manually (typing (copy/pasting) all the options in a text file), it doesn't contain any special character, but when I later sign that file file rdpsign, it adds that character again.
    How do we get rid of it? It's preventing our provisioning system from substituting username.

    Hello MarkosP,
    Thanks for contacting Microsoft.
    These bytes are regular UTF-16 byte order marks. See here:
    http://en.wikipedia.org/wiki/Byte_order_mark#UTF-16
    If the tool you use on the RDP file does not support UTF-16, you can try to convert the file to ASCII. This will probably work for most RDP files, except if some
    string uses some unicode character not present in the ASCII character set. Here is some info (see the powershell section in the first post/question):
    http://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets​
    Best regards,
    Sophia Sun
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Check for a character in a string

    Hi you all.
    I wanted to know how to check if a character is in a String.
    I'll explain. I have a String "HELLO" and now I would like to know if this String contains an '&'. How to handle that?
    Greetz,
    Frenck

    Hi Frenck,
    Try the following code sample:
              String str = "HE&LLO";
              char ch = '&';
              if ( str.indexOf( ch ) == -1 ) {
                   System.out.println("Character is NOT Present !" );
              } else {
                   System.out.println("Character Present at position: " + (str.indexOf(ch) + 1));
    Hope that helps!
    Smita

  • Mcedit: cursor position with tab after upgrade to mc 4.8.5 [SOLVED]

    Hello,
    I upgraded to mc 4.8.5-1 a few days ago. Using mcedit:
    If one (or more) TABs were used in a line the position of the cursor is two chars away (to the right) from where it should be. Simply edit the line and you see what i mean. Never had this effect in former versions.
    If the line includes no tab character the cursor position is ok.
    It seems to be a bug - can someone agree?
    Last edited by LessWire (2012-09-14 23:59:55)

    Bug solved with 4.8.6-1 incoming today - thanks!

  • Get an item at a particluar position in Advanced Datagrid

    I want to access some property of an item lying at nth position in an advanced datagrid. I was not able to find any method which can return me this result. getChildAt method returns display objects of the adv DG and not the items in it. Also numChildren poperty returns number of display objects and not the number of rows.

    You MUST get it from the dataProvider.  That is the only place the data exists.  You can use the DataGrid events to return the row and column indexes into the dataProvider item.
    Or you can get a reference to the renderer, and then get to the dataprovider item through the data property. Or through your own property if it is a custom renderer.
    But one way or another, you must get to the dataProvider item.
    I do not recall the syntax, look into the dataGrid events in the docs.
    Tracy

  • Getting immediate character behind to the cursor in JTextPane?

    when i use left arrow, i am not getting the immediate character behind to the cursor, but i am getting the character after 2 position in JTextPane. It works fine for the right arrow. since we get the character based on the caretposition. how can i get immediate character behind to the cursor when i use other arrow's other than right arrow?
    thnx in advance

    Swing related questions should be posted in the Swing fourm.
    The simple answer would be to use getCaretPosition -1. But this is probably not what you are looking for and you question is not very detailed.
    So, posting a simple 10 line executable demo program would be nice. Its probably a problem with the order of events.

  • Mouseclicking a character places caret differently in Java6

    Clicking a character in a JTextField or JTextArea can result in a different caret position in Java6 than in Java5.
    With the letters 'dog' in the field, click the mouse on the arc at the left edge of the d. Now try clicking it at the right edge near the vertical line.
    With Java5, MS Word, Notepad, its as if there is a divider in the center of the character. Clicking to the left of a character's center positions the cursor before the character, in this case a 'd'. Clicking to the right of the center positions the cursor after the character, in this case between the 'd' and the 'o'.
    With Java6, the cursor is always positioned to the left of the character. To position the caret between the 'd' and the 'o' you must click on the 'o'.
    We're getting some user complaints. I submitted this as a potential bug - wondering if anyone else noticed or if there is a property setting to revert to the old behavior?
    Jeff

    Here's an SSCE that exhibits the problem. Both 1.5 and 1.6.7 behave similarly - clicking on the right vertical of a 'u' in 'dug' positions the cursor to the right of the 'u'. Switching to 1.6.16, the cursor goes to the left of the 'u'.
    // Geary Example 22-5
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Test extends JFrame {
         private JTextField field = new JTextField(10);
         private JButton b = new JButton("Default Button");
         private JCheckBox cb = new JCheckBox(
                                            "Text field fires action event");
         public Test() {
              Container contentPane = getContentPane();
              SwingUtilities.getRootPane(this).setDefaultButton(b);
              cb.setSelected(true);
              contentPane.setLayout(new FlowLayout(
                                                      FlowLayout.CENTER,10,20));
              contentPane.add(field);
              contentPane.add(b);
              contentPane.add(cb);
              b.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(Test.this,
                             "Button fired action event");
              field.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(Test.this,
                             "Textfield fired action event");
              cb.addActionListener(new ActionListener() {
                   private Keymap km;
                   private KeyStroke ks;
                   private Action action;
                   public void actionPerformed(ActionEvent e) {
                        if(cb.isSelected()) {
                             km.addActionForKeyStroke(ks, action);
                        else {
                             if(ks == null) {
                                  km = field.getKeymap();
                                  ks = KeyStroke.getKeyStroke(
                                                      KeyEvent.VK_ENTER, 0);
                                  action = km.getAction(ks);
                             km.removeKeyStrokeBinding(ks);
         public static void main(String args[]) {
              GJApp.launch(new Test(),
                   "Default Buttons",300,300,350,200);
    class GJApp extends WindowAdapter {
         static private JPanel statusArea = new JPanel();
         static private JLabel status = new JLabel(" ");
         static private ResourceBundle resources;
         public static void launch(final JFrame f, String title,
                                         final int x, final int y,
                                         final int w, int h) {
              launch(f,title,x,y,w,h,null);     
         public static void launch(final JFrame f, String title,
                                         final int x, final int y,
                                         final int w, int h,
                                         String propertiesFilename) {
              f.setTitle(title);
              f.setBounds(x,y,w,h);
              f.setVisible(true);
              statusArea.setBorder(BorderFactory.createEtchedBorder());
              statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
              statusArea.add(status);
              status.setHorizontalAlignment(JLabel.LEFT);
              f.setDefaultCloseOperation(
                                       WindowConstants.DISPOSE_ON_CLOSE);
              if(propertiesFilename != null) {
                   resources = ResourceBundle.getBundle(
                                  propertiesFilename, Locale.getDefault());
              f.addWindowListener(new WindowAdapter() {
                   public void windowClosed(WindowEvent e) {
                        System.exit(0);
         static public JPanel getStatusArea() {
              return statusArea;
         static public void showStatus(String s) {
              status.setText(s);
         static Object getResource(String key) {
              if(resources != null) {
                   return resources.getString(key);
              return null;
    }

  • Adding a colored character

    I would like a script for adding a colored character to the current cursor position.
    The script for add the character to the position I have courtesy of indesign secrets but I don't know how to specify the character color. (I don't want to chage the color of the rest of the text in the paragraph.
    if (app.selection[0].constructor.name == "InsertionPoint"){
        with (app.selection[0].insertionPoints[0]){ // insertion point
                    contents = String.fromCharCode(0x05B0); //
    What do I need to add for the color change.
    Thanks,

    Hi,
    Thanks a lot for your response, I had just workout that the following code works:
    app.selection[0].insertionPoints[0].fillColor = "C=20 M=70 Y=86 K=8";
    app.selection[0].insertionPoints[0].contents = String.fromCharCode(0x05B0);
    1) I am very interested why you added the lines, (I am a complete beginner at scripting and interested in learning better techniques)
             if (app.selection[0].constructor.name == "InsertionPoint"){
             with (app.selection[0].insertionPoints[0]){ // insertion point
    2) I would like to develop the script to check the the second character of the paragraph to see if it is CharCode(0x05B0) if it is not then I want to add (not replace) the character there.  If there is already a 0x05B0 there then I don't want anything to be added there.
    3) If the 0x05B0 is added the I would like to give it (only the one character) a XML tag to it so that it can be reformatted if the paragraph style late changes it's color.
    Will be most happy if I can do this,

  • Move character through sequence

    Hi, I'm after abit of direction!
    I have a character which sits in a sequence of numbers ('0' and '1') called in from a text file. The character needs to move through the '0's and get on to the other side. The program so far displays the character in amidst the grid of numbers in the DOS window but i'm not sure what I need to do next. How do I get this character 'name' to check whats next to it in order to make a move?
    I just need to know what I need to do i.e. do I use an array or if statement? Do I need to specify something like North, East, South, West and get to do something like grid++ or something to check what comes next? Sorry this may sound a bit vague. I'll try and post the code if I can.
    Thanks.

    Hi,
    I havn't got very far yet but heres the code for the 3 classes I have so far;
    (Most of the maze class has already been written)
    (Please excuse the comments!)
    MAZE:
    import java.io.*;
    import java.util.*;
    import EasyIO.*;
    public class Maze {
    * int number of rows
    private int height;
    * int number of columns
    private int width;
    * enter row for maze. NOTE start counting at 0
    private int startRow;
    * char 2D array to hold the representation of the maze.
    * wall = '1'
    * free = '0'
    private char [][] grid;
    * Maze constructor which gets all the data from a text file.
    * File format:
    * 1st line : height width startRow
    * other lines : rows of maze
    public Maze(String filename)
    String line = "";
    StringTokenizer tokenizer;
    try
    FileReader fr = new FileReader(filename);
    BufferedReader br = new BufferedReader(fr);
    line = br.readLine();
    tokenizer = new StringTokenizer(line);
    height = Integer.parseInt(tokenizer.nextToken());
    width = Integer.parseInt(tokenizer.nextToken());
    startRow = Integer.parseInt(tokenizer.nextToken());
    grid = new char[height][width];
    line = br.readLine();
    int row = 0;
    while (line != null && row < height)
    for (int column = 0; column < line.length() && column < width; column++)
    grid[row][column] = line.charAt(column);
    row++;
    line = br.readLine();
    br.close();
    catch (FileNotFoundException e)
    System.out.println("The file "+filename+" was not found. The following error occurred: "+e);
    EasyIn.pause("Press <Enter> to continue");
    catch (IOException e)
    System.out.println("The file "+filename+" could not be read. The following error occurred: "+e);
    EasyIn.pause("Press <Enter> to continue");
    catch (NumberFormatException e) {
    System.out.println("Error in the first line of the file "+filename+": a number was expected.");
    EasyIn.pause("Press <Enter> to continue");
    public void showMaze()
    for (int i=0;i<grid.length; i++)
    for (int j=0; j<grid.length;j++)
    System.out.print(grid[i][j]);
    System.out.println();
    public void getStartRobot()
    grid[startRow][0]='R';
    public char gridChar(int r, int c)
    return grid[r][c];
    ROBOT:
    import EasyIO.*;
    public class Robot
         //**Attributes**
    private String r; //Enable user to enter name for robot
    private char robot; //Take first letter of the name for robot to use in maze
         private int rowPosition; //Get position in row robot is currently in
         private int columnPosition; //Get position in column the robot is currently in
         //**Methods**
         public Robot();
         String r = new String();
    System.out.println("Enter a name for your Robot:");
    r = EasyIn.getString();
    System.out.println("Hi " + r.toUpperCase());
    EasyIn.pause("Press <Enter>");
    System.out.println("You will now be known as " + r.charAt(0) + "!");
    robot = r.charAt(0);
         EasyIn.pause("Press <Enter> to quit");
              getPosition();
              getNewPosition();
              //not sure about coding below?!
              Right=++
              Left = --
              if (wall=1)     //If wall =1 then turn right
                                  //check if wall is 1 or 0 infront
              {                    //if 0 move forward, else turn right
                   Right;
              else if (wall=0)
    DRIVER:
    import EasyIO.*;
    // call in robot class
    public class Driver
    public static void main (String[]args)
    System.out.println("Enter a maze name: ");
    // String f ="Maze1.txt";
    String f = EasyIn.getString();
    System.out.println();
    System.out.println("This is the maze - ");
    Maze m = new Maze(f); //Code to display maze
    m.showMaze();
    m.getStartRobot();
    System.out.println();
    m.showMaze();
    int r,c;
    r=2;
    c=1;
    m.gridChar(r,c);
    System.out.println("Character at grid position " + r + ", " + c + " is " + m.gridChar(r,c));
    At the moment it reads in a text file which has the maze - the collection of 0 and 1. All it then does is display the maze. And then display again with an R in the first coloumn with first 0.
    Its not reading anything from the Robot class at the moment? It needs to read from this text file file, follow the 0's through to the other side of the maze and out!
    I really need to know What do I do next?!
    Thanks

Maybe you are looking for

  • New Session

    hi all, I have one main report which calls another report on button click from ALV of main report. while calling this new report I am using Function module ABAP4_CALL_TRANSACTION with addition STARTING NEW TASK to open that report in a new session. t

  • How do I set up a file (business card) in Illustrator CS6 to print front and back?

    I'm working on a double sided business card and I would like to know how to set up the file in Illustrator. Thanks

  • Item Price Y Inactive because of subsequent price

    Hello Experts, I have a 2 pricing conditions with condition class "Price" (B) in the pricing procedure. This resulted that the first condition type having control status as Y "Inactive because of subsequent price". Only the second condition type is a

  • EP IAC iview javascript object required error

    Hi,   We have installed EP 6.0 SR1 and ITS 6.20 with service pack 19(with hotfix) in one domain. We have created IAC iviews in Enterprise portal. We are accessing the enterprise portal from different domain and we are getting javascript error <i>obje

  • Latest firmware version for x3-00

    Any body please help me what is the latest firmware version for x3-00. I'm in india and currently i'm using v8.54. Please don't give me any links. Please tell me the correct answer.